aboutsummaryrefslogtreecommitdiff
path: root/execs/Day05.hs
diff options
context:
space:
mode:
Diffstat (limited to 'execs/Day05.hs')
-rw-r--r--execs/Day05.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/execs/Day05.hs b/execs/Day05.hs
index aae8f49..27397f7 100644
--- a/execs/Day05.hs
+++ b/execs/Day05.hs
@@ -1,12 +1,11 @@
1module Main where 1module Main where
2 2
3import Data.Char (digitToInt) 3import Data.Char (digitToInt)
4import Utils (binaryToInt)
4 5
5doValidate = toInt . map readBin 6doValidate = binaryToInt . map readBin
6toInt = foldl (\a x -> a * 2 + digitToInt x) 0 7readBin s | s `elem` "FL" = '0'
7readBin 'F' = '0' 8 | otherwise = '1'
8readBin 'L' = '0'
9readBin _ = '1'
10 9
11main :: IO () 10main :: IO ()
12main = do 11main = do