diff options
Diffstat (limited to 'execs/Day05.hs')
-rw-r--r-- | execs/Day05.hs | 9 |
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 @@ | |||
1 | module Main where | 1 | module Main where |
2 | 2 | ||
3 | import Data.Char (digitToInt) | 3 | import Data.Char (digitToInt) |
4 | import Utils (binaryToInt) | ||
4 | 5 | ||
5 | doValidate = toInt . map readBin | 6 | doValidate = binaryToInt . map readBin |
6 | toInt = foldl (\a x -> a * 2 + digitToInt x) 0 | 7 | readBin s | s `elem` "FL" = '0' |
7 | readBin 'F' = '0' | 8 | | otherwise = '1' |
8 | readBin 'L' = '0' | ||
9 | readBin _ = '1' | ||
10 | 9 | ||
11 | main :: IO () | 10 | main :: IO () |
12 | main = do | 11 | main = do |