From 4c3a50166bf0f78ce89459c352cc1c6536a8b96d Mon Sep 17 00:00:00 2001 From: DJ O'Leary Date: Sat, 29 Nov 2025 20:23:02 +0100 Subject: chore: make language folders snake_case --- 2024/ocaml/lib/grid/grid.ml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 2024/ocaml/lib/grid/grid.ml (limited to '2024/ocaml/lib/grid/grid.ml') diff --git a/2024/ocaml/lib/grid/grid.ml b/2024/ocaml/lib/grid/grid.ml new file mode 100644 index 0000000..0d6bc4c --- /dev/null +++ b/2024/ocaml/lib/grid/grid.ml @@ -0,0 +1,14 @@ +let rec to_grid_aux tokens max_width acc = + match tokens with + | [] -> acc + | h :: t -> + let new_cell = Cell.create h |> Cell.with_left acc in + let new_acc = acc |> Cell.with_right new_cell in + to_grid_aux t max_width new_acc + +let to_grid tokens max_width : Cell.t option = + match tokens with + | [] -> None + | h :: t -> + let first_cell = Cell.create h in + Some (to_grid_aux t max_width first_cell) -- cgit v1.2.3