diff options
author | Marvin Borner | 2023-03-07 00:19:48 +0100 |
---|---|---|
committer | Marvin Borner | 2023-03-07 00:19:48 +0100 |
commit | 9ef10406c067d0a0532d609212a94519af402b87 (patch) | |
tree | 8d30448311ec43678873050ff7654d7f6c348ec8 /samples/aoc/2021/01/solve.bruijn | |
parent | 61b749cf19b30a307ef537f989e5509c3c4aa17f (diff) |
Added a few advent of code solutions
Diffstat (limited to 'samples/aoc/2021/01/solve.bruijn')
-rw-r--r-- | samples/aoc/2021/01/solve.bruijn | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/samples/aoc/2021/01/solve.bruijn b/samples/aoc/2021/01/solve.bruijn new file mode 100644 index 0000000..d48acff --- /dev/null +++ b/samples/aoc/2021/01/solve.bruijn @@ -0,0 +1,14 @@ +:import std/Math . +:import std/String . + +part1 [{ [[(1 <? 0) (+1) (+0)]] | 0 , ~0 }] + +part2 [{ [[(1 <? 0) (+1) (+0)]] | 0 , ~(~(~0)) }] + +main [parts nums] + nums number! <$> (lines 0) + parts [∑(part1 0) : ∑(part2 0)] + +# equivalent alternative using std/Pair P +# part1 [length (filter (P.uncurry …<?…) (zip 0 ~0))] +# part2 [length (filter (P.uncurry …<?…) (zip 0 ~(~(~0))))] |