1
0
Fork 0
advent-of-code-2022/ocaml/1.ml

13 lines
323 B
OCaml
Raw Normal View History

2023-01-10 16:23:37 +00:00
#load "str.cma" ;;
2023-01-11 12:35:10 +00:00
#use "lib/file_utils.ml" ;;
2023-01-10 16:23:37 +00:00
2023-01-11 12:35:10 +00:00
let contents = read_file "inputs/1.txt" in
2023-01-10 16:23:37 +00:00
let maxcal = Str.split (Str.regexp "\n\n") contents
|> List.map (String.split_on_char '\n')
|> List.map (List.map (int_of_string))
|> List.map (List.fold_left (+) 0)
|> List.fold_left (max) 0
2023-01-11 12:35:10 +00:00
in
2023-01-10 16:23:37 +00:00
Printf.printf "%d" maxcal