From 2be3c1f086444bd698729e93991951d4cd43b5ad Mon Sep 17 00:00:00 2001 From: Sijmen Schoon Date: Sat, 1 Dec 2018 18:09:41 +0100 Subject: [PATCH] oops --- Day1B.hs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Day1B.hs b/Day1B.hs index 5c096ef..04db47a 100644 --- a/Day1B.hs +++ b/Day1B.hs @@ -5,9 +5,8 @@ import qualified Data.IntSet as S handle :: Int -> S.IntSet -> [Int] -> Int handle freq history (nextDelta:xs) - | (S.size s) == (S.size history) = freq -- When the frequency is in the history set, return it - | otherwise = handle (freq + nextDelta) (S.insert freq history) xs -- Recurse otherwise - where s = S.insert freq history + | S.member freq history = freq -- When the frequency is in the history set, return it + | otherwise = handle (freq + nextDelta) (S.insert freq history) xs -- Recurse otherwise handle _ _ _ = error "xs should not be empty :(" main :: IO ()