fun with cryptic oneliners
This commit is contained in:
parent
e1c70e7827
commit
85ecd2cfd0
2 changed files with 2 additions and 0 deletions
|
@ -13,4 +13,5 @@ in {
|
|||
part1 = sumInBlock input;
|
||||
part2 = listSum (map sumInBlock
|
||||
(map (do: head (reSplit "don't\\(\\)" do)) (reSplit "do\\(\\)" input)));
|
||||
part2oneline = foldl' add 0 (map (pipe' [ (matchAll "mul\\(([[:digit:]]{1,3}),([[:digit:]]{1,3})\\)") (foldl' (p: l: p + (head l |> toInt) * (last l |> toInt)) 0) ]) (map (pipe' [(reSplit "don't\\(\\)") head ]) (reSplit "do\\(\\)" (readFile ./input))));
|
||||
}
|
||||
|
|
|
@ -17,4 +17,5 @@ with builtins; rec {
|
|||
invert = f: x: !(f x);
|
||||
elemAtMid = l: elemAt l ((length l) / 2);
|
||||
removeAll = rl: (flip pipe) (map remove rl);
|
||||
pipe' = flip pipe;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue