From 5446705237a6fc1842f02b0a8b3bc2b74aab4557 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Fri, 24 Feb 2023 16:54:17 +0100 Subject: Added code samples --- samples/aoc/2022/01/input | 14 ++++++++++++++ samples/aoc/2022/01/solve.bruijn | 7 +++++++ samples/readme.md | 12 ++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 samples/aoc/2022/01/input create mode 100644 samples/aoc/2022/01/solve.bruijn create mode 100644 samples/readme.md (limited to 'samples') diff --git a/samples/aoc/2022/01/input b/samples/aoc/2022/01/input new file mode 100644 index 0000000..2094f91 --- /dev/null +++ b/samples/aoc/2022/01/input @@ -0,0 +1,14 @@ +1000 +2000 +3000 + +4000 + +5000 +6000 + +7000 +8000 +9000 + +10000 diff --git a/samples/aoc/2022/01/solve.bruijn b/samples/aoc/2022/01/solve.bruijn new file mode 100644 index 0000000..7764db8 --- /dev/null +++ b/samples/aoc/2022/01/solve.bruijn @@ -0,0 +1,7 @@ +:import std/Math . +:import std/String . + +main [lmax sums] + numbers number! <$> (lines 0) + parts split-at =?‣ numbers + sums sum <$> parts diff --git a/samples/readme.md b/samples/readme.md new file mode 100644 index 0000000..7ab3472 --- /dev/null +++ b/samples/readme.md @@ -0,0 +1,12 @@ +# Samples + +## AOC + +These samples solve some of the [Advent of +Code](https://adventofcode.com) problems. + + cat input | bruijn solve.bruijn + +**Be aware** that lambda calculus is generally incredibly inefficient. +For example, the obvious solution for the very simple problem 2022/01 +takes around 1 minute and 4GB of memory using the full input. -- cgit v1.2.3