ocaml: phase 6 Either module + Hashtbl.copy (+4 tests, 602 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 23s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 23s
Either module (mirrors OCaml 4.12+ stdlib): left x / right x is_left / is_right find_left / find_right (return Option) map_left / map_right (single-side mappers) fold lf rf e (case dispatch) equal eq_l eq_r a b compare cmp_l cmp_r a b (Left < Right) Constructors are bare 'Left x' / 'Right x' (OCaml 4.12+ exposes them directly without an explicit type-decl). Hashtbl.copy: build a fresh cell with _hashtbl_create walk _hashtbl_to_list and re-add each (k, v) mutating one copy doesn't touch the other (Hashtbl.length t + Hashtbl.length t2 = 3 after fork-and-add verifies that adds to t2 don't appear in t)
This commit is contained in:
@@ -407,6 +407,13 @@ _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 6 — Either module + Hashtbl.copy (+4 tests, 602
|
||||
total). Either: left, right, is_left, is_right, find_left,
|
||||
find_right, map_left, map_right, fold, equal, compare. Constructors
|
||||
are bare `Left x` / `Right x` (per OCaml 4.12+). Hashtbl.copy
|
||||
builds a fresh cell, walks `_hashtbl_to_list`, and re-adds; mutating
|
||||
one copy doesn't touch the other (verified by `Hashtbl.length t +
|
||||
Hashtbl.length t2 = 3` after a fork-and-add).
|
||||
- 2026-05-09 Phase 5.1 — json_pretty.ml baseline (recursive ADT
|
||||
serialization). Defines a JSON-like ADT (JNull / JBool / JInt /
|
||||
JStr / JList) and recursively pretty-prints to a string, then
|
||||
|
||||
Reference in New Issue
Block a user