repositories
/
aoc20.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
755844d
)
one line
author
Mart Lubbers
<mart@martlubbers.net>
Thu, 10 Dec 2020 07:22:25 +0000
(08:22 +0100)
committer
Mart Lubbers
<mart@martlubbers.net>
Thu, 10 Dec 2020 07:22:25 +0000
(08:22 +0100)
10/one.icl
patch
|
blob
|
history
diff --git
a/10/one.icl
b/10/one.icl
index
32ffe8b
..
a71ff6d
100644
(file)
--- a/
10/one.icl
+++ b/
10/one.icl
@@
-16,10
+16,6
@@
Start w
# ls = sort [0:read io]
= (one ls, two ls)
-one ls = uncurry (*) $ foldl jolt (0, 1) [b-a\\a<-ls & b<-tl ls]
-where
- jolt (j1, j3) 3 = (j1, j3+1)
- jolt (j1, j3) 1 = (j1+1, j3)
- jolt (j1, j3) _ = (j1, j3)
+one ls = prod $ map length $ group $ sort [3:[b-a\\a<-ls & b<-tl ls]]
two ls = prod [[0,1,2,4,7,12,20,33,53]!!length l\\l<-group [b-a\\a<-ls & b<-tl ls] | all ((==)1) l]