ocaml: phase 6 Hashtbl (+6 tests, 332 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 32s

Backing store is a one-element list cell holding a SX dict; keys
coerced to strings via str so int/string keys work uniformly. API:
create, add, replace, find, find_opt, mem, length.

_hashtbl_create / _hashtbl_add / _hashtbl_replace / _hashtbl_find_opt /
_hashtbl_mem / _hashtbl_length primitives wired in eval.sx; OCaml-side
Hashtbl module wraps them in lib/ocaml/runtime.sx.
This commit is contained in:
2026-05-08 12:57:22 +00:00
parent 6d7197182e
commit 812aa75d43
4 changed files with 66 additions and 1 deletions

View File

@@ -248,6 +248,9 @@ SX CEK evaluator (both JS and OCaml hosts)
`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.)_
- [~] `Hashtbl`: `create`, `add`, `find`, `find_opt`, `replace`, `mem`,
`length`. Backed by a one-element list cell holding a SX dict;
keys coerced to strings via `str` for polymorphic-key support.
- [~] `String`: `length`, `get`, `sub`, `concat`, `uppercase_ascii`,
`lowercase_ascii`, `starts_with`. _(Pending: split_on_char, trim,
contains, ends_with, index_opt, replace_all.)_
@@ -362,6 +365,10 @@ the "mother tongue" closure: OCaml → SX → OCaml. This means:
_Newest first._
- 2026-05-08 Phase 6 — `Hashtbl` (+6 tests, 332 total). Backing store is
a one-element list cell holding a SX dict; keys are coerced to
strings via `str` so any value type can serve as a key. API: create,
add, replace, find, find_opt, mem, length.
- 2026-05-08 Phase 5 — HM extensions for tuples and lists (+7 tests,
326 total). Tuple type `(hm-con "*" TYPES)`, list type `(hm-con
"list" (TYPE))`. `ocaml-infer-tuple` threads substitution through