ocaml: phase 4 'let f (a, b) = body' tuple-param on inner-let (+3 tests, 556 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 22s

Mirrors iteration 101's parse-fun change inside parse-let's
parse-one!:

  - same '(IDENT, ...)' detection on collect-params
  - same __pat_N synth name for the function param
  - same innermost-first match-wrapping

Difference: for inner-let the wrapping is applied to the rhs of the
let-binding (which is the function value), not directly to a fun
body.

  let f (a, b) = a + b in f (3, 7)            = 10
  let g x (a, b) = x + a + b in g 1 (2, 3)    = 6
  let h (a, b) (c, d) = a * b + c * d
    in h (1, 2) (3, 4)                        = 14
This commit is contained in:
2026-05-09 04:36:33 +00:00
parent 64f4f10c32
commit b526d81a4c
3 changed files with 62 additions and 5 deletions

View File

@@ -407,6 +407,14 @@ _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 4 — `let f (a, b) = body in body2` tuple-param on
inner-let bindings (+3 tests, 556 total). Mirrors iteration 101's
parse-fun change inside parse-let's parse-one!: same `(IDENT, ...)`
detection, same `__pat_N` synth name, same innermost-first match
wrapping — but applied to the rhs of the let-binding (which is the
function value). Lets us write `let f (a, b) = a + b in f (3, 7)`,
`let g x (a, b) = x + a + b in g 1 (2, 3)`, and `let h (a, b)
(c, d) = a * b + c * d in h (1, 2) (3, 4)`.
- 2026-05-09 Phase 4 — `fun (a, b) -> body` tuple-param destructuring
(+4 tests, 553 total). parse-fun's collect-params now detects
`(IDENT, ...)` (lookahead at peek-tok-at 1/2 to distinguish from