aboutsummaryrefslogtreecommitdiffhomepage
path: root/samples/aoc/2020/01/solve.bruijn
blob: c3eb669c77f5518cdbb0cdbd29aedc2a60173421 (plain) (blame)
1
2
3
4
5
6
7
8
9
:import std/Combinator .
:import std/String .
:import std/Math .

solve (find (sum → (eq? (+2020)))) → product

main trim → lines → (map string→number) → (φ (cons ⋔ solve) part1 part2)
	part1 [[[~1 : {}0] <$> (drop ^0 1)] <++> (enumerate 0)]
	part2 [[[[~2 : (~1 : {}0)] <$> (drop ^0 2)] <++> (enumerate (drop ^0 1))] <++> (enumerate 0)]