diff options
| author | Alexandre Jesus <adbjesus@gmail.com> | 2025-12-03 21:05:57 +0000 |
|---|---|---|
| committer | Alexandre Jesus <adbjesus@gmail.com> | 2025-12-03 21:05:57 +0000 |
| commit | 6d80c94eb7ea8ac0421df0832409b63be7c1246a (patch) | |
| tree | 675ceb3feb257c4986860b4a10de5becc677a94a /bin/main.ml | |
| parent | c260cea076a5dda847e108454aedc10385ea5c10 (diff) | |
| download | aoc2025-6d80c94eb7ea8ac0421df0832409b63be7c1246a.tar.gz aoc2025-6d80c94eb7ea8ac0421df0832409b63be7c1246a.zip | |
Setup ocamlformat
Define a initial setup for ocamlformat. I might still tweak the
settings in the future.
Diffstat (limited to 'bin/main.ml')
| -rw-r--r-- | bin/main.ml | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/bin/main.ml b/bin/main.ml index 403c606..2769553 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -9,24 +9,33 @@ open Aoc2025 let parse_day s = match int_of_string_opt s with | Some n when n >= 1 && n <= 12 -> n - | _ -> failwith (Format.sprintf "Day '%s' is invalid, expected an integer between 1 and 12" s) + | _ -> + failwith + (Format.sprintf + "Day '%s' is invalid, expected an integer between 1 and 12" s) let parse_part s = match int_of_string_opt s with | Some n when n >= 1 && n <= 2 -> n - | _ -> failwith (Format.sprintf "Part '%s' is invalid, expected an integer between 1 and 2" s) + | _ -> + failwith + (Format.sprintf + "Part '%s' is invalid, expected an integer between 1 and 2" s) let day_part_fn day part = let day = parse_day day in let part = parse_part part in match (day, part) with - | (1, 1) -> Day01.part1 - | (1, 2) -> Day01.part2 - | (2, 1) -> Day02.part1 - | (2, 2) -> Day02.part2 - | (3, 1) -> Day03.part1 - | (3, 2) -> Day03.part2 - | _ -> failwith (Format.sprintf "Day %d, part %d, has not yet been implemented\n" day part) + | 1, 1 -> Day01.part1 + | 1, 2 -> Day01.part2 + | 2, 1 -> Day02.part1 + | 2, 2 -> Day02.part2 + | 3, 1 -> Day03.part1 + | 3, 2 -> Day03.part2 + | _ -> + failwith + (Format.sprintf "Day %d, part %d, has not yet been implemented\n" day + part) let () = let usage_msg = "aoc2025 <day> <part> <inputfile>" in @@ -43,7 +52,7 @@ let () = try let s = Unix.gettimeofday () in fn ic; - Printf.printf "%.3f" ((Unix.gettimeofday ()) -. s) + Printf.printf "%.3f" (Unix.gettimeofday () -. s) with e -> close_in_noerr ic; raise e |
