summaryrefslogtreecommitdiff
path: root/2025
diff options
context:
space:
mode:
Diffstat (limited to '2025')
-rw-r--r--2025/ocaml/lib/application/d05p01.ml3
-rw-r--r--2025/ocaml/lib/application/d05p01.mli4
-rw-r--r--2025/ocaml/lib/presentation/cli.ml4
3 files changed, 11 insertions, 0 deletions
diff --git a/2025/ocaml/lib/application/d05p01.ml b/2025/ocaml/lib/application/d05p01.ml
new file mode 100644
index 0000000..4bf79ab
--- /dev/null
+++ b/2025/ocaml/lib/application/d05p01.ml
@@ -0,0 +1,3 @@
+let err_empty_input = "input is empty"
+
+let solve input () = if input = "" then Error err_empty_input else Ok 0
diff --git a/2025/ocaml/lib/application/d05p01.mli b/2025/ocaml/lib/application/d05p01.mli
new file mode 100644
index 0000000..85c3dd5
--- /dev/null
+++ b/2025/ocaml/lib/application/d05p01.mli
@@ -0,0 +1,4 @@
+val solve : string -> unit -> (int, string) result
+(** [solve input ()] is the solution for the first part of the five day of advent of code 2025 for [input].
+ The solution for an empty input is [Error msg].
+ Requires: [input] to be a string. *)
diff --git a/2025/ocaml/lib/presentation/cli.ml b/2025/ocaml/lib/presentation/cli.ml
index b4c990c..7428381 100644
--- a/2025/ocaml/lib/presentation/cli.ml
+++ b/2025/ocaml/lib/presentation/cli.ml
@@ -28,6 +28,10 @@ let run_day _ = function
run_solver "D04P01" Application.D04p01.solve filepath ;
run_solver "D04P02" Application.D04p02.solve filepath ;
0
+ | 5 ->
+ let filepath = "../_input/day_05.txt" in
+ run_solver "D05P01" Application.D05p01.solve filepath ;
+ 0
| _ ->
failwith "day not implemented"