ocaml: phase 1+3 'when' guard in 'function | pat -> body' (+3 tests, 464 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 26s

parse-function now consumes optional 'when GUARD-EXPR' before -> and
emits (:case-when PAT GUARD BODY) — same handling as match clauses.
function-style sign extraction now works:
  (function | n when n > 0 -> 1 | n when n < 0 -> -1 | _ -> 0)
This commit is contained in:
2026-05-08 20:26:28 +00:00
parent b92a98fb45
commit 029c1783f4
3 changed files with 26 additions and 3 deletions

View File

@@ -407,6 +407,9 @@ _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-08 Phase 1+3 — `function | pat when GUARD -> body | …`
guard support (+3 tests, 464 total). `parse-function` mirrors the
match-clause when-handling.
- 2026-05-08 Phase 5.1 — anagrams.ml baseline (18/18 pass). Counts
anagram-equivalence groups via Hashtbl + List.sort + String.get +
for-loop. `["eat";"tea";"tan";"ate";"nat";"bat"]` → 3 groups.