Evaluator: data-first higher-order forms — ho-swap-args auto-detects
(map coll fn) vs (map fn coll), both work. Threading + HO: (-> data
(map fn)) dispatches through CEK HO machinery via quoted-value splice.
17 new tests in test-cek-advanced.sx.
Fix plan pages: add mother-language, isolated-evaluator, rust-wasm-host
to page-functions.sx plan() — were in defpage but missing from URL router.
Aser error handling: pages.py now catches EvalError separately, renders
visible error banner instead of silently sending empty content. All
except blocks include traceback in logs.
Scope primitives: register collect!/collected/clear-collected!/emitted/
emit!/context in shared/sx/primitives.py so hand-written _aser can
resolve them (fixes ~cssx/flush expansion failure).
New test file: shared/sx/tests/test_aser_errors.py — 19 pytest tests
for error propagation through all aser control flow forms.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
test-continuations-advanced.sx (41 tests):
multi-shot continuations, composition, provide/context basics,
provide across shift, scope/emit basics, scope across shift
test-render-advanced.sx (27 tests):
nested components, dynamic content, list patterns,
component patterns, special elements
Bugs found and documented:
- case in render context returns DOM object (CEK dispatches case
before HTML adapter sees it — use cond instead for render)
- context not visible in shift body (correct: shift body runs
outside the reset/provide boundary)
- Multiple shifts consume reset (correct: each shift needs its own
reset)
Python runner: skip test-continuations-advanced.sx without --full.
JS 815/815 standard, 938/938 full, Python 706/706.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
provide/context and scope/emit!/emitted now use CEK continuation
frames instead of an imperative global stack. Scope state is part
of the continuation — captured by shift, restored by k invocation.
New frame types:
- ProvideFrame: holds name + value, consumed when body completes
- ScopeAccFrame: holds name + mutable emitted list
New CEK special forms:
- context: walks kont for nearest ProvideFrame, returns value
- emit!: walks kont for nearest ScopeAccFrame, appends to emitted
- emitted: walks kont for nearest ScopeAccFrame, returns list
Kont walkers: kont-find-provide, kont-find-scope-acc
This fixes the last 2 test failures:
- provide survives resume: scope captured by shift, restored by k
- scope and emit across shift: accumulator preserved in continuation
JS Full: 870/870 (100%)
JS Standard: 747/747 (100%)
Python: 679/679 (100%)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Continuations are now multi-shot — k can be invoked multiple times.
Each invocation runs the captured frames via nested cek-run and
returns the result to the caller's continuation.
Fix: continue-with-call runs ONLY the captured delimited frames
(not rest-kont), so the continuation terminates and returns rather
than escaping to the outer program.
Fixed 4 continuation tests:
- shift with multiple invokes: (list (k 10) (k 20)) → (11 21)
- k returned from reset: continuation callable after escaping
- invoke k multiple times: same k reusable
- k in data structure: store in list, retrieve, invoke
Remaining 2 failures: scope/provide across shift boundaries.
These need scope state tracked in frames (not imperative push/pop).
JS 747/747, Full 868/870, Python 679/679.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Higher-order forms (map, filter, reduce, some, every?, for-each,
map-indexed) now evaluate their arguments via CEK frames instead
of nested trampoline(eval-expr(...)) calls.
Added HoSetupFrame — staged evaluation of HO form arguments.
When all args are evaluated, ho-setup-dispatch sets up the
iteration frame. This keeps a single linear CEK continuation
chain instead of spawning nested CEK instances.
14 nested eval-expr calls eliminated (39 → 25 remaining).
The remaining 25 are in delegate functions (sf-letrec, sf-scope,
parse-keyword-args, qq-expand, etc.) called infrequently.
All tests unchanged: JS 747/747, Full 864/870, Python 679/679.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Dedicated page documenting and demonstrating content-addressed
computation. How it works, why it matters, the path to IPFS.
Live demo: counter + name widget with CID generation, history,
and restore-from-CID input.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Hash frozen SX to a content identifier (djb2 → hex). Same state
always produces the same CID. Store by CID, retrieve by CID.
- content-hash: djb2 hash of SX text → hex string
- content-put/get: in-memory content store
- freeze-to-cid: freeze scope → store → return CID
- thaw-from-cid: look up CID → thaw signals
- char-code-at / to-hex primitives for both platforms
- Live demo: counter + name widget, content-address button,
CID display, restore from CID input, CID history
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- freeze-scope "home-stepper" captures step-idx signal
- Each step/back saves to localStorage via freeze-to-sx
- On mount, restores from localStorage via thaw-from-sx
- Invalid state resets to default (step 9)
- Clear preview lake before replay to prevent duplicates
- Register local-storage-get/set/remove as primitives
- Arrows 3x bigger
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace raw CEK state serialization with named freeze scopes.
A freeze scope collects signals registered within it. On freeze,
signal values are serialized to SX. On thaw, values are restored.
- freeze-scope: scoped effect delimiter for signal collection
- freeze-signal: register a signal with a name in the current scope
- cek-freeze-scope / cek-thaw-scope: freeze/thaw by scope name
- freeze-to-sx / thaw-from-sx: full SX text round-trip
- cek-freeze-all / cek-thaw-all: batch operations
Also: register boolean?, symbol?, keyword? predicates in both
Python and JS platforms with proper var aliases.
Demo: counter + name input with Freeze/Thaw buttons.
Frozen SX: {:name "demo" :signals {:count 5 :name "world"}}
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Documents and demonstrates serializable CEK state. Type an expression,
step to any point, click Freeze to see the frozen SX. Click Thaw to
resume from the frozen state and get the result.
- New page at /sx/(geography.(cek.freeze))
- Nav entry under CEK Machine
- Interactive island demo with step/run/freeze/thaw buttons
- Documentation: the idea, freeze format, thaw/resume, what it enables
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When a tag's open step is evaluated, both its opening and closing
brackets go big+bold together. Previously close ) had the close
step index so it stayed faint until much later.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Code view uses a lake with imperative DOM spans. Each token has its
base syntax colour class stored. On each step, update-code-highlight
iterates all spans and sets class based on step-idx: evaluated tokens
go bold, current step gets violet bg, future stays normal.
No reactive re-rendering of the code view — direct DOM class updates.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Each token span independently reacts to step-idx via deref-as-shift
- Colours match highlight.py: sky for HTML tags, rose for components,
emerald for strings, violet for keywords, amber for numbers
- Current step bold+violet bg, completed steps dimmed
- No closing paren on separate line
- Fix bare nil → NIL in eventDetail and domGetData
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace header source view with interactive CEK render stepper.
Auto-parses on mount, step forward/back through DOM construction
with CSSX styling. Uses lake for preview persistence.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Cache the style element reference in _cssx-style-el so flush-cssx-to-dom
never creates more than one. Previous code called dom-query on every
flush, which could miss the element during rapid successive calls,
creating duplicates.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add css_extras parameter to create_base_app. Legacy apps (blog, market
etc) get the default extras (basics.css, cards.css, blog-content.css,
prism.css, FontAwesome). SX app passes css_extras=[] — it uses CSSX
for styling and custom highlighting, not Prism/FA/Ghost.
Reduces <style id="sx-css"> from ~100KB+ of irrelevant CSS to ~5KB
of Tailwind resets + only the utility rules the page actually uses.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
A defisland that lets users type an SX expression, step through CEK
evaluation one transition at a time, and see C/E/K registers update
live. Demonstrates that cek-step is pure data->data.
- cek.sx geography: add ~geography/cek/demo-stepper island with
source input, step/run/reset buttons, state display, step history
- platform_js.py: register CEK stepping primitives (make-cek-state,
cek-step, cek-terminal?, cek-value, make-env, sx-serialize) so
island code can access them
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Plato's allegory of the cave applied to web development: HTML/CSS/JS as
shadows on the wall, s-expressions as Forms, the bootstrapper as
demiurge, anamnesis as the wire format's efficiency, the divided line
as SX's rendering hierarchy, and the Form of the Good as the principle
that representation and thing represented should be identical.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The depth axis is done — CEK (Layer 0) through patterns (Layer 4) are
all specced, bootstrapped, and tested. Rewrite the plan to reflect
reality and reframe the next steps as validation (serialization,
stepping debugger, content-addressed computation) before building
superstructure (concurrent CEK, linear effects).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
init-client.sx contains browser-only code (dom-listen, collect! cssx).
It was in sx/sx/ which load_sx_dir scans and evaluates server-side,
causing "Undefined symbol: dom-listen". Move to sx/init-client.sx
which is outside the component load path.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add frames.sx and cek.sx to the reactive spec registry with prose
- Add CEK Frames and CEK Machine under Specs → Reactive in nav
- Add Spec Explorer link under Language section
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Styles (indicator, jiggle animation) and nav aria-selected behavior
were inline Python strings in sx/app.py. Now they live in sx/sx/init.sx
as proper SX source — styles via collect! "cssx", nav via dom-listen.
The shell's inline_css is empty; CSSX handles style injection on boot.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
All signal operations (computed, effect, batch, etc.) now dispatch
function calls through cek-call, which routes SX lambdas via cek-run
and native callables via apply. This replaces the invoke shim.
Key changes:
- cek.sx: add cek-call (defined before reactive-shift-deref), replace
invoke in subscriber disposal and ReactiveResetFrame handler
- signals.sx: replace all 11 invoke calls with cek-call
- js.sx: fix octal escape in js-quote-string (char-from-code 0)
- platform_js.py: fix JS append to match Python (list concat semantics),
add Continuation type guard in PLATFORM_CEK_JS, add scheduleIdle
safety check, module ordering (cek before signals)
- platform_py.py: fix ident-char regex (remove [ ] from valid chars),
module ordering (cek before signals)
- run_js_sx.py: emit PLATFORM_CEK_JS before transpiled spec files
- page-functions.sx: add cek and provide page functions for SX URLs
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Both plans had nav entries and component files but were missing from
the page-functions.sx case statement, causing 404s on their URLs.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace hand-written serialize/sx_serialize/sx_parse in Python with
spec-derived versions from parser.sx. Add parser as a Python adapter
alongside html/sx/async — all 48 parser spec tests pass.
Add reactive runtime plan to sx-docs: 7 feature layers (ref, foreign
FFI, state machines, commands with undo/redo, render loops, keyed
lists, client-first app shell) — zero new platform primitives.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
test-cek-reactive.sx: 9 tests across 4 suites — deref pass-through,
signal without reactive-reset, reactive-reset shift with continuation
capture, scope disposal cleanup. run_cek_reactive_tests.py: new runner
loading signals+frames+cek. Both test runners override sx_ref.eval_expr
back to tree-walk so interpreted .sx uses tree-walk internally.
Plan page added to sx-docs.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add `scope` special form to eval.sx: (scope name body...) or
(scope name :value v body...) — general dynamic scope primitive
- `provide` becomes sugar: (provide name value body...) calls scope
- Rename provide-push!/provide-pop! to scope-push!/scope-pop! throughout
all adapters (async, dom, html, sx) and platform implementations
- Update boundary.sx: Tier 5 now "Scoped effects" with scope-push!/
scope-pop! as primary, provide-push!/provide-pop! as aliases
- Add scope form handling to async adapter and aser wire format
- Update sx-browser.js, sx_ref.py (bootstrapped output)
- Add scopes.sx docs page, update provide/spreads/demo docs
- Update nav-data, page-functions, docs page definitions
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Rename to .sx.future — the file uses #z3 reader macros that aren't
implemented yet, causing a ParseError that blocks ALL component loading
and breaks the provide docs page.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Lead with provide/emit! from the first sentence. make-spread/spread?/spread-attrs
are now presented as user-facing API on top of the provide/emit! substrate,
not as independent primitives. Restructured sections, removed redundant
"deeper primitive" content that duplicated the new section I.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- New geography article (provide.sx): four primitives, demos, nested scoping,
adapter comparison, spec explorer links
- Updated spreads article section VI: provide/emit! is now implemented, not planned
- Fixed foundations.sx: ~docs/code-block → ~docs/code (undefined component
was causing the page to silently fail to render)
- Added nav entry and defpage route for provide/emit! article
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The plans were routed in page-functions.sx (GraphSX URL eval) but
missing from the defpage case in docs.sx (server-side slug route).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add \uXXXX unicode escape support to parser.py and parser.sx spec
- Add char-from-code primitive (Python chr(), JS String.fromCharCode())
- Fix variadic infix operators in both bootstrappers (js.sx, py.sx) —
(+ a b c d) was silently dropping terms, now left-folds correctly
- Rebootstrap sx_ref.py and sx-browser.js with all fixes
- Fix 3 pre-existing map-dict test failures in shared/sx/tests/run.py
- Add live demos alongside examples in spreads essay (side-by-side layout)
- Add scoped-effects plan: algebraic effects as unified foundation for
spread/collect/island/lake/signal/context
- Add foundations plan: CEK machine, the computational floor, three-axis
model (depth/topology/linearity), Curry-Howard correspondence
- Route both plans in page-functions.sx and nav-data.sx
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
SX parser doesn't process \u escapes — they render as literal text.
Use actual UTF-8 characters (→, —, £, ⬡) directly in source.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
(code "...") is an HTML tag — works in render context but not inside
(list ...) which fully evaluates args. Use plain strings in table rows.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Without this, /sx/(geography.(spreads)) 404s because spreads isn't
defined as a page function to return the content component.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>