host: polish — a third fold domain (deps) + a live execute-fold demo (/workflow-demo)

Two concrete demonstrations of the composition architecture:

THIRD DOMAIN (proves step 8's "a new domain is just a dict + leaf, no new control flow").
host/comp-deps folds a composition to the object ids it TRANSCLUDES — the static contains
DAG of a body. It reuses host/comp-fold's seq/alt/each dispatch verbatim; only the leaf
(collect `(ref ID)`) + accumulator (concat) are new. Useful in its own right (what a
(seq (ref c0) (each … (ref …))) body pulls in; context-specific — alt picks the taken
branch). compose suite 20/20.

LIVE EXECUTE-FOLD DEMO (makes step 7 tangible, parallel to /compose-demo for render).
/workflow-demo runs ONE composition object's :body through host/exec-run — the SAME structure
the render-fold would turn into HTML, folded by execute into a plan of effects (validate →
branch on status → notify each recipient). host/blog-seed-workflow-demo! + host/blog-workflow-
demo + route + serve.sh seed. Shows the behaviour model IS an execute-fold over a composition
object — the same object the block editor authors. blog suite 165/165.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-01 05:16:56 +00:00
parent 10bc091890
commit af3d81d108
5 changed files with 77 additions and 0 deletions

View File

@@ -128,3 +128,18 @@
;; public entry: render a composition node against a context environment -> HTML string.
(define host/comp-render (fn (node ctx) (host/comp-fold node ctx host/comp--render-dom)))
;; ── a THIRD domain (deps → the object ids a composition transcludes) ──
;; Proof of step 8's claim "a new domain is just a dict + leaf": no new control flow — seq/
;; alt/each come from the core unchanged; only the leaf + accumulator are new. The deps-leaf
;; collects `(ref ID)` ids; everything else contributes nothing. Useful in its own right: the
;; static transclusion set of a body (which card objects it pulls in — the contains DAG for a
;; (seq (ref c0) (each … (ref …))) body). Context-specific (alt picks the taken branch).
(define host/comp--deps-leaf
(fn (node ctx dom)
(if (and (= (type-of node) "list") (= (str (first node)) "ref"))
(list (str (first (rest node))))
(list))))
(define host/comp--deps-dom
{:empty (list) :combine concat :overflow (list) :leaf host/comp--deps-leaf})
(define host/comp-deps (fn (node ctx) (host/comp-fold node ctx host/comp--deps-dom)))