From: Neil Smith <neil.git@njae.me.uk>
Date: Mon, 5 Dec 2016 12:35:56 +0000 (+0000)
Subject: Day 5 slightly terser
X-Git-Url: https://git.njae.me.uk/?a=commitdiff_plain;h=9e997c074e98e00f7bc5e0755c9218d8f8e4c237;p=advent-of-code-16.git

Day 5 slightly terser
---

diff --git a/advent05.hs b/advent05.hs
index d86bd5a..c86b14c 100644
--- 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 (candidate:candidates)
+findPassword p (c:cs)
   | Map.size p == 8 = p
-  | otherwise = findPassword p' candidates
-      where p' = dontReplace candidate p
+  | otherwise = findPassword p' cs
+      where p' = dontReplace c p