summaryrefslogtreecommitdiff
path: root/ocaml/lib/year2025/day02/part01/range.ml
diff options
context:
space:
mode:
authorDJ O'Leary <dijitol@proton.me>2026-06-27 00:11:43 +0200
committerDJ O'Leary <dijitol@proton.me>2026-06-27 00:11:43 +0200
commit976048a85403fbb0751c34fa42703a3c47f6e918 (patch)
tree46e321d8120c45e318ead66f60165b0b854c85a1 /ocaml/lib/year2025/day02/part01/range.ml
parent6d8fb621d1e93b83786890d6d9cb6f0d8defa8ae (diff)
refactor!: change repo directory structure for ocaml
Diffstat (limited to 'ocaml/lib/year2025/day02/part01/range.ml')
-rw-r--r--ocaml/lib/year2025/day02/part01/range.ml18
1 files changed, 18 insertions, 0 deletions
diff --git a/ocaml/lib/year2025/day02/part01/range.ml b/ocaml/lib/year2025/day02/part01/range.ml
new file mode 100644
index 0000000..ba27568
--- /dev/null
+++ b/ocaml/lib/year2025/day02/part01/range.ml
@@ -0,0 +1,18 @@
+open Id
+
+module Range = struct
+ type t = ID.t * ID.t
+
+ let create (id1, id2) = (ID.create id1, ID.create id2)
+
+ let rec collect range = collect_range_aux [] range
+
+ and collect_range_aux lst (id1, id2) =
+ match id1 <= id2 with
+ | false ->
+ lst
+ | true ->
+ collect_range_aux (id1 :: lst) (ID.incr id1, id2)
+
+ let pp (id1, id2) = "(L" ^ ID.pp id1 ^ ", R" ^ ID.pp id2 ^ ")"
+end