From 976048a85403fbb0751c34fa42703a3c47f6e918 Mon Sep 17 00:00:00 2001 From: DJ O'Leary Date: Sat, 27 Jun 2026 00:11:43 +0200 Subject: refactor!: change repo directory structure for ocaml --- ocaml/lib/year2025/day02/part02/range.ml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 ocaml/lib/year2025/day02/part02/range.ml (limited to 'ocaml/lib/year2025/day02/part02/range.ml') diff --git a/ocaml/lib/year2025/day02/part02/range.ml b/ocaml/lib/year2025/day02/part02/range.ml new file mode 100644 index 0000000..ba27568 --- /dev/null +++ b/ocaml/lib/year2025/day02/part02/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 -- cgit v1.2.3