ocaml: phase 6 Stack + Queue modules (+5 tests, 430 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 35s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 35s
Stack: ref-holding-list LIFO. push/pop/top/length/is_empty/clear. Queue: two-list (front, back) amortised O(1) queue. push/pop/length/ is_empty/clear. Both in OCaml syntax in runtime.sx.
This commit is contained in:
@@ -267,6 +267,11 @@ SX CEK evaluator (both JS and OCaml hosts)
|
||||
- [~] `Buffer`: `create`, `add_string`, `add_char`, `contents`, `length`,
|
||||
`clear`, `reset`. Backed by a ref holding a list of strings; reverse +
|
||||
`String.concat` on `contents`. Mostly-OCaml impl.
|
||||
- [~] `Stack`: `create`, `push`, `pop`, `top`, `is_empty`, `length`,
|
||||
`clear`. Backed by a ref-holding-list (LIFO).
|
||||
- [~] `Queue`: `create`, `push`, `pop`, `is_empty`, `length`, `clear`.
|
||||
Backed by a `(front, back)` tuple-of-lists pair (amortised O(1)
|
||||
enqueue/dequeue via list reversal).
|
||||
- [~] `Sys`: `os_type` (`"SX"`), `word_size`, `max_array_length`,
|
||||
`max_string_length`, `executable_name`, `big_endian`, `unix`,
|
||||
`win32`, `cygwin`. Constants only; `argv`/`getenv_opt`/`command`
|
||||
@@ -394,6 +399,11 @@ _Newest first._
|
||||
recognise `!` as the prefix-deref of an application argument, so
|
||||
`String.concat "" (List.rev !b)` parses as `(... (deref b))`. Buffer
|
||||
uses a ref holding a string list; contents reverses and concats.
|
||||
- 2026-05-08 Phase 6 — `Stack` and `Queue` modules in OCaml (+5 tests,
|
||||
430 total). Stack: ref-holding-list LIFO with push/pop/top/length/
|
||||
is_empty/clear. Queue: amortised O(1) two-list `(front, back)` queue
|
||||
with push/pop/length/is_empty/clear. Both written entirely in OCaml
|
||||
via lib/ocaml/runtime.sx.
|
||||
- 2026-05-08 Phase 5.1+1+2 — calc.ml baseline (11/11 pass) — a
|
||||
recursive-descent calculator parsing `(1 + 2) * 3 + 4` to 13. Two
|
||||
parser bugs fixed along the way: parse-let now handles inline
|
||||
|
||||
Reference in New Issue
Block a user