Day 1 part 1

This commit is contained in:
Nathan McCarty 2022-12-01 10:57:04 -05:00
parent 670a10eb39
commit 34d5494402
Signed by: thatonelutenist
GPG Key ID: D70DA3DD4D1E9F96
2 changed files with 2270 additions and 0 deletions

19
01/Main.idr Normal file
View File

@ -0,0 +1,19 @@
import System.File.ReadWrite
import Data.String
import Data.List1
part1 : String -> IO ()
part1 input =
let inputLines = lines input
grouped = split (== "") inputLines
parsed = map (map cast) grouped
totals = map (foldr (+) 0) parsed
in do printLn $ foldr max 0 totals
main : IO ()
main = do file <- readFile "input"
case file of
Right content =>
do putStr "Part 1: "
part1 content
Left err => printLn err

2251
01/input Normal file

File diff suppressed because it is too large Load Diff