diff options
| author | DJ O'Leary <dijitol@proton.me> | 2025-12-02 12:54:13 +0100 |
|---|---|---|
| committer | DJ O'Leary <dijitol@proton.me> | 2025-12-02 12:54:13 +0100 |
| commit | c4f8835256a3f6b5df477a3cfa4da6fafecc386f (patch) | |
| tree | a23f3be74e519c19529b0254ca795ec42d322bdc /2025/ocaml/lib/presentation/cli.ml | |
| parent | 121eba870e6faee3eb0985b53451c6a76e74a6c5 (diff) | |
refactor(cli): factor out shared code
Diffstat (limited to '2025/ocaml/lib/presentation/cli.ml')
| -rw-r--r-- | 2025/ocaml/lib/presentation/cli.ml | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/2025/ocaml/lib/presentation/cli.ml b/2025/ocaml/lib/presentation/cli.ml index e691545..184de09 100644 --- a/2025/ocaml/lib/presentation/cli.ml +++ b/2025/ocaml/lib/presentation/cli.ml @@ -1,10 +1,13 @@ +let run_solver name solver filepath = + let content = Infrastructure.File.read filepath in + let answer = solver content () in + Logs.app (fun m -> m "%s=%d" name answer) + let run_day = function | 1 -> - let content = Infrastructure.File.read "../_input/day_01.txt" in - let answerP1 = Application.D01p01.solve content () in - Logs.app (fun m -> m "D1P1=%d" answerP1) ; - let answerP2 = Application.D01p02.solve content () in - Logs.app (fun m -> m "D1P2=%d" answerP2) ; + let filepath = "../_input/day_01.txt" in + run_solver "D01P01" Application.D01p01.solve filepath ; + run_solver "D01P02" Application.D01p02.solve filepath ; 0 | _ -> failwith "day not implemented" |
