ocaml: phase 5.1 merge_sort.ml baseline (user mergesort, sum=44)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 23s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 23s
User-implemented mergesort that exercises features added across the
last few iterations:
let rec split lst = match lst with
| x :: y :: rest ->
let (a, b) = split rest in (* iter 98 let-tuple destruct *)
(x :: a, y :: b)
| ...
let rec merge xs ys = match xs with
| x :: xs' ->
match ys with (* nested match-in-match *)
| y :: ys' -> ...
...
List.fold_left (+) 0 (sort [...]) (* iter 89 (op) section *)
Sum of [3;1;4;1;5;9;2;6;5;3;5] = 44 regardless of order, so the
result is also a smoke test of the implementation correctness — if
merge_sort drops or duplicates an element the sum diverges. 26
baseline programs total.
This commit is contained in:
@@ -407,6 +407,12 @@ _Newest first._
|
||||
binary search tree (`type 'a tree = Leaf | Node of 'a * 'a tree *
|
||||
'a tree`) with insert + in-order traversal. Tests parametric ADT,
|
||||
recursive match, List.append, List.fold_left.
|
||||
- 2026-05-09 Phase 5.1 — merge_sort.ml baseline (user-implemented
|
||||
mergesort, sorted sum = 44). Stress-tests `let (a, b) = split rest
|
||||
in (x :: a, y :: b)` (let-tuple destructuring inside a recursive
|
||||
match arm), nested match-in-match for the merge merge step, and
|
||||
the (op) operator section `(+)` as fold accumulator. 26 baseline
|
||||
programs total.
|
||||
- 2026-05-09 Phase 4 — top-level `let f (a, b) = body` tuple-param
|
||||
decl (+3 tests, 559 total). parse-decl-let (which lives outside
|
||||
the ocaml-parse scope and lacks parse-pattern access) uses a
|
||||
|
||||
Reference in New Issue
Block a user