diff options
author | Marvin Borner | 2024-03-21 13:23:41 +0100 |
---|---|---|
committer | Marvin Borner | 2024-03-21 13:34:34 +0100 |
commit | 2065029025c6e53eb550717755996d1d6fc5f60d (patch) | |
tree | b2ed64b9cb890925a57edc0577ef6faab7519b61 /samples/aoc/2022 | |
parent | 93b53a5354620d94b128008d0b17670cc87c92f5 (diff) |
Fixed AOC samples
Diffstat (limited to 'samples/aoc/2022')
-rw-r--r-- | samples/aoc/2022/01/solve.bruijn | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/samples/aoc/2022/01/solve.bruijn b/samples/aoc/2022/01/solve.bruijn index 7b2eaf6..e213e85 100644 --- a/samples/aoc/2022/01/solve.bruijn +++ b/samples/aoc/2022/01/solve.bruijn @@ -1,9 +1,7 @@ +:import std/Combinator . :import std/Math . :import std/String . -main [answer] - numbers string→number <$> (lines 0) - parts split-list-by =?‣ numbers - sums sum <$> parts - answer build (sort-desc sums) - build [^0 : ∑(take (+3) 0)] +main blocks → (map (map string→number)) → (map sum) → sort-desc → res + res [^0 : (^0 + ^(~0) + ^(~(~0)))] + blocks [split-list-by (eq? "\n") (lines 0)] |