first part of day one

This commit is contained in:
Schrottkatze 2023-12-03 00:42:58 +01:00
parent 925f3fc166
commit 21028fe61e

15
haskell/1-0.hs Normal file
View file

@ -0,0 +1,15 @@
import Data.Char
digits :: String -> String
digits = filter isDigit
calibrationValue :: String -> Int
calibrationValue x = read [ head $ digits x, last $ digits x ]
main = do
inputs <- readFile "inputs/1.0"
let lns = lines inputs
let res = sum $ map calibrationValue lns
print res