From d41dca8b131d580eed2bcdc382bda9a634c57bf9 Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 6 Dec 2020 09:15:11 +0530 Subject: le point free has arrived --- execs/Day05.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'execs') diff --git a/execs/Day05.hs b/execs/Day05.hs index 27397f7..a47c024 100644 --- a/execs/Day05.hs +++ b/execs/Day05.hs @@ -1,6 +1,7 @@ module Main where import Data.Char (digitToInt) +import Data.List (sort) import Utils (binaryToInt) doValidate = binaryToInt . map readBin @@ -10,7 +11,7 @@ readBin s | s `elem` "FL" = '0' main :: IO () main = do n <- lines <$> readFile "input/05" - let valids = map doValidate n + let valids = sort $ map doValidate n ans1 = maximum valids print ans1 - print $ sum [minimum valids .. ans1] - sum valids + print $ (+1) . fst . head . dropWhile ((==1) . uncurry (flip (-))) . (zip <*> tail) $ valids -- cgit v1.2.3