From 2065029025c6e53eb550717755996d1d6fc5f60d Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Thu, 21 Mar 2024 13:23:41 +0100 Subject: Fixed AOC samples --- samples/aoc/2022/01/solve.bruijn | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'samples/aoc/2022') 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)] -- cgit v1.2.3