projects
/
advent-of-code-16.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fef438e
)
Day 5 slightly terser
author
Neil Smith
<neil.git@njae.me.uk>
Mon, 5 Dec 2016 12:35:56 +0000
(12:35 +0000)
committer
Neil Smith
<neil.git@njae.me.uk>
Mon, 5 Dec 2016 12:35:56 +0000
(12:35 +0000)
advent05.hs
patch
|
blob
|
history
diff --git
a/advent05.hs
b/advent05.hs
index d86bd5aee32ee5301f82a3dc099b2e4eafcc604d..c86b14c97b5130f4fc3d7630f5ebe7db4ba06aea 100644
(file)
--- a/
advent05.hs
+++ b/
advent05.hs
@@
-38,7
+38,7
@@
dontReplace :: (Integer, Char) -> Password -> Password
dontReplace (k, v) = Map.insertWith (\_ v -> v) k v
findPassword :: Password -> [(Integer, Char)] -> Password
-findPassword p (c
andidate:candidate
s)
+findPassword p (c
:c
s)
| Map.size p == 8 = p
- | otherwise = findPassword p' c
andidate
s
- where p' = dontReplace c
andidate
p
+ | otherwise = findPassword p' cs
+ where p' = dontReplace c p