ocaml: phase 6 expanded stdlib (+15 tests, 319 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 54s

List: concat/flatten, init, find/find_opt, partition, mapi/iteri,
assoc/assoc_opt. Option: iter/fold/to_list. Result: get_ok/get_error/
map_error/to_option.

Fixed skip-to-boundary! in parser to track let..in / begin..end /
struct..end / for/while..done nesting via a depth counter — without
this, nested-let inside a top-level decl body trips over the
decl-boundary detector. Stdlib functions like List.init / mapi / iteri
use begin..end to make their nested-let intent explicit.
This commit is contained in:
2026-05-08 12:49:23 +00:00
parent bc557a5ad2
commit 88c02c7c73
4 changed files with 202 additions and 20 deletions

View File

@@ -240,12 +240,13 @@ SX CEK evaluator (both JS and OCaml hosts)
- [~] `List`: `map`, `filter`, `fold_left`, `fold_right`, `length`, `rev`,
`append`, `iter`, `for_all`, `exists`, `mem`, `nth`, `hd`, `tl`,
`rev_append`. _(Pending: concat/flatten, iteri/mapi, find/find_opt,
assoc/assq, sort, init, combine, split, partition.)_
- [~] `Option`: `map`, `bind`, `value`, `get`, `is_none`, `is_some`.
_(Pending: fold/join/iter/to_list/to_result.)_
- [~] `Result`: `map`, `bind`, `is_ok`, `is_error`. _(Pending:
fold/get_ok/get_error/map_error/to_option.)_
`rev_append`, `concat`/`flatten`, `init`, `iteri`, `mapi`, `find`,
`find_opt`, `assoc`, `assoc_opt`, `partition`. _(Pending:
sort/stable_sort, combine, split.)_
- [~] `Option`: `map`, `bind`, `value`, `get`, `is_none`, `is_some`,
`iter`, `fold`, `to_list`. _(Pending: join/to_result.)_
- [~] `Result`: `map`, `bind`, `is_ok`, `is_error`, `get_ok`,
`get_error`, `map_error`, `to_option`. _(Pending: fold/join.)_
- [~] `String`: `length`, `get`, `sub`, `concat`, `uppercase_ascii`,
`lowercase_ascii`, `starts_with`. _(Pending: split_on_char, trim,
contains, ends_with, index_opt, replace_all.)_
@@ -360,6 +361,15 @@ the "mother tongue" closure: OCaml → SX → OCaml. This means:
_Newest first._
- 2026-05-08 Phase 6 — expanded stdlib slice (+15 tests, 319 total).
List: concat/flatten, init, find/find_opt, partition, mapi/iteri,
assoc/assoc_opt. Option: iter, fold, to_list. Result: get_ok,
get_error, map_error, to_option. Also fixed parser's
skip-to-boundary! to track `let..in` / `begin..end` / `struct..end`
/ `for/while..done` nesting via a depth counter so nested let
expressions inside top-level decl bodies don't trip over the
decl-boundary detector. Stdlib functions like `init` use `begin..end`
to make nested-let intent explicit.
- 2026-05-08 Phase 3 — `exception` declarations (+4 tests, 304 total).
`exception NAME [of TYPE]` parses to `(:exception-def NAME [ARG-SRC])`.
Runtime is a no-op: exception values are just tagged ctor values, so