From 9e997c074e98e00f7bc5e0755c9218d8f8e4c237 Mon Sep 17 00:00:00 2001 From: Neil Smith Date: Mon, 5 Dec 2016 12:35:56 +0000 Subject: [PATCH] Day 5 slightly terser --- advent05.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 -- 2.34.1