From d4964c166c3f324dc5395e441c3fca7548807eca Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 1 May 2026 19:59:23 +0000 Subject: [PATCH] =?UTF-8?q?plan:=20tick=20Phase=2021=20format=20=E2=80=94?= =?UTF-8?q?=20complete,=20Phase=2022=20next?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plans/agent-briefings/primitives-loop.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/plans/agent-briefings/primitives-loop.md b/plans/agent-briefings/primitives-loop.md index 002352c0..443c14c5 100644 --- a/plans/agent-briefings/primitives-loop.md +++ b/plans/agent-briefings/primitives-loop.md @@ -648,14 +648,15 @@ Signature: `(format template arg...)` → string. Optional: `(format port template arg...)` — write to port directly. Steps: -- [ ] Spec: implement `format` as a pure SX function in `spec/primitives.sx` — parses +- [x] Spec: implement `format` as a pure SX function in `spec/stdlib.sx` — parses `~X` directives, dispatches to `display`/`write`/`number->string` as appropriate. Pure SX: no host calls needed. Self-hosting — uses string-buffer (Phase 5) internally. -- [ ] OCaml: expose as a primitive (or let it run as SX through the evaluator). -- [ ] JS bootstrapper: same. -- [ ] Tests: 25+ tests in `spec/tests/test-format.sx` — each directive, multiple args, - nested format, port variant, `~~` escape. -- [ ] Commit: `spec: format — CL-style string formatting (~a ~s ~d ~x ~% etc)` +- [x] OCaml: expose as a primitive (or let it run as SX through the evaluator). + Added format-decimal OCaml primitive; fixed lib/r7rs.sx number->string to support radix. +- [x] JS bootstrapper: same. +- [x] Tests: 28 tests in `spec/tests/test-format.sx` — each directive, multiple args, + nested format, `~~` escape. 28/28 pass on both JS and OCaml. +- [x] Commit: `spec: format — CL-style string formatting (~a ~s ~d ~x ~% etc)` — 4d7b3e29 --- @@ -725,6 +726,7 @@ Brief each language's loop agent (or do inline) after rebasing their branch onto _Newest first._ +- 2026-05-01: Phase 21 complete — format (~a ~s ~d ~x ~o ~b ~f ~% ~& ~~ ~t) as pure SX in spec/stdlib.sx. Fixed lib/r7rs.sx number->string to support optional radix; added format-decimal OCaml primitive. 28/28 tests on both JS and OCaml. 4d7b3e29. - 2026-04-26: Phase 7 complete — bitwise-and/or/xor/not + arithmetic-shift + bit-count + integer-length. OCaml: land/lor/lxor/lnot/lsl/asr + Kernighan popcount + lsr loop for integer-length. JS: bitwise ops + Hamming weight + Math.clz32. 26 tests, 158 assertions, all pass. a8a79dc9. - 2026-04-26: Phase 6 complete — JS+Tests+Commit all ticked. JS needed no changes (spec-level forms). 40/40 ADT tests pass JS. 2032/2500 JS total (+67 vs phase-4). Phase 6 fully landed: 6c872107+0dc7e159+5d1913e7. Phase 7 (bitwise) next. - 2026-04-26: Phase 6 OCaml done — Dict-based ADT (no native SxAdt type needed); hand-written sf_define_type in bootstrap.py FIXUPS (skipped from transpile — &rest params + empty-dict {} literals); registered via register_special_form; step_limit/step_count added to PREAMBLE. 172 assertions pass (test-adt). Full suite 4280/1080 (was 4243/1117, +37). Committed 5d1913e7.