aoc/2021/01/solve.bruijn

Problem description

:import std/String .
:import std/Math .

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))))]