ocaml: phase 6 List.combine/split/iter2/fold_left2/map2 (+4, 367 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 30s

Mechanical pair-walk OCaml implementations. failwith on length
mismatch matches Stdlib semantics. List module now covers 30+
functions.
This commit is contained in:
2026-05-08 13:48:48 +00:00
parent dac9cf124f
commit 16df48ff74
3 changed files with 63 additions and 1 deletions

View File

@@ -900,6 +900,16 @@ cat > "$TMPFILE" << 'EPOCHS'
(epoch 2105)
(eval "(ocaml-type-of-program \"let rec fact n = if n = 0 then 1 else n * fact (n - 1);; fact 5\")")
;; ── More List functions: combine/split/iter2/fold_left2/map2 ──
(epoch 2200)
(eval "(ocaml-run \"List.combine [1;2;3] [\\\"a\\\";\\\"b\\\";\\\"c\\\"]\")")
(epoch 2201)
(eval "(ocaml-run \"List.split [(1,\\\"a\\\");(2,\\\"b\\\")]\")")
(epoch 2202)
(eval "(ocaml-run \"List.fold_left2 (fun a b c -> a + b + c) 0 [1;2;3] [10;20;30]\")")
(epoch 2203)
(eval "(ocaml-run \"List.map2 (fun a b -> a + b) [1;2;3] [10;20;30]\")")
EPOCHS
OUTPUT=$(timeout 180 "$SX_SERVER" < "$TMPFILE" 2>/dev/null)
@@ -1423,6 +1433,12 @@ check 2103 "shape -> Int" '"shape -> Int"'
check 2104 "program x+y" '"Int"'
check 2105 "program fact 5" '"Int"'
# ── More List functions ─────────────────────────────────────────
check 2200 "List.combine" '("tuple" 3 "c")'
check 2201 "List.split" '("tuple" (1 2) ("a" "b"))'
check 2202 "List.fold_left2" '66'
check 2203 "List.map2" '(11 22 33)'
TOTAL=$((PASS + FAIL))
if [ $FAIL -eq 0 ]; then
echo "ok $PASS/$TOTAL OCaml-on-SX tests passed"