don't hardcode blurpsequence
[aoc20.git] / 10 / one.icl
1 module one
2
3 import StdEnv
4
5 import Data.List
6 import Data.Func
7
8 read :: *File -> [Int]
9 read f
10 # (ok, i, f) = freadi f
11 | not ok = []
12 = [i:read f]
13
14 Start w
15 # (io, w) = stdio w
16 # ls = sort [0:read io]
17 = (one ls, two ls)
18
19 one ls = prod $ map length $ group $ sort [3:[b-a\\a<-ls & b<-tl ls]]
20
21 two ls = prod [blurp !! length l\\l<-group [b-a\\a<-ls & b<-tl ls] | all ((==)1) l]
22
23 blurp =: let seq a b = [a+b-1:seq b (a+b)] in seq 0 1