blob: 1c14b3b57a69199de834be8a0cd1cf24a908db33 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
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 string→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))))]
|