aboutsummaryrefslogtreecommitdiffhomepage
path: root/samples/aoc/2018/01/solve.bruijn
blob: 3d26a2e784bd0e398ec7440655b6aa8339d7e7d3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
:import std/Combinator .
:import std/String .
:import std/Math .
:import std/Set S

part1 ∑‣ ⧗ (List FrequencyDiff) → Frequency

part2 z [[[[rec]]]] S.empty (+0)
	rec S.has? 1 2 1 go
		go 3 (S.add 1 2) (1 + ^0) ~0

main [parts nums]
	nums string→signed-number <$> (init (lines 0))
	parts [(part1 0) : (part2 (cycle 0))]