Fix home-stepper paren bugs, harden defisland multi-body, add SX Tools essay

Two paren bugs in home-stepper.sx caused the home page to render blank:

1. Line 222 had one extra ) that prematurely closed the letrec bindings
   list — rebuild-preview and do-back became body expressions instead
   of bindings, making them undefined in scope.

2. Lines 241-308 were outside the let/letrec scope entirely — the outer
   let closed at line 240, so freeze-scope, cookie restore, source
   parsing, and the entire div rendering tree had no access to signals
   or letrec functions.

Also hardens defisland to wrap multi-expression bodies in (begin ...),
matching the Python-side fix from 9f0c541. Both spec/evaluator.sx and
the OCaml transpiled sx_ref.ml are updated.

Adds SX Tools essay under Applications — the revised plan for structural
tree reading/editing tools for .sx files, motivated by this exact bug.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-25 17:52:16 +00:00
parent 1777f631a5
commit c18f46278f
6 changed files with 223 additions and 8 deletions

View File

@@ -219,7 +219,7 @@
;; Component expressions handled by lake's reactive render
nil))
(swap! step-idx inc)
(update-code-highlight)))))
(update-code-highlight))))
(rebuild-preview (fn (target)
;; Rebuild preview in one shot from steps-to-preview (pure SX→DOM)
(let ((container (get-preview)))
@@ -237,7 +237,7 @@
(rebuild-preview target)
(reset! step-idx target)
(update-code-highlight)
(set-cookie "sx-home-stepper" (freeze-to-sx "home-stepper"))))))))
(set-cookie "sx-home-stepper" (freeze-to-sx "home-stepper")))))))
;; Freeze scope for persistence — same mechanism, cookie storage
(freeze-scope "home-stepper" (fn ()
(freeze-signal "step" step-idx)))
@@ -305,6 +305,6 @@
;; Live preview — shows partial result up to current step.
;; Same SX rendered by server (HTML) and client (DOM).
(lake :id "home-preview"
(steps-to-preview (deref steps) (deref step-idx))))))
(steps-to-preview (deref steps) (deref step-idx))))))))