Wit

Composing constructs

Once you know each primitive, the interesting question is how they stack: data feeding iteration feeding conditionals, captures fed by data access, definitions that use other definitions. This short bridge page shows the happy seams — and the two places where constructs intentionally do not compose, so you meet the errors before they surprise you.

Data, iteration, and conditionals together

The workhorse pattern — loop a collection of records, gate each with a condition:

source
#hands: [ { name - Ada, awake - true }, { name - Bo, awake - false } ]

(each @hands as hand)
  (if @hand.awake is true) @hand.name is on watch. (end)
(end)
result

Ada is on watch.

Data access works as a parameter value (access-in-param) and as a condition's left-hand side (access-in-condition).

Captures fed by data

A definition's captures can be filled from a data record read with dotted access:

source
#weil: { author - Simone Weil, work - Gravity and Grace }

#cite ||author, work|| ::author::, _::work::_. cite#

@cite |author @weil.author| |work @weil.work| cite@
result

Simone Weil, Gravity and Grace.

A definition body may reference another definition (def-of-def), and inline emphasis composes inside a block body:

source
@aside She _crossed_ the *threshold* at dusk. aside@
result

(emphasis-inside-node-body.)

The seams that do not compose

Seam 1 — !! is not a use-side closer.

The !! token closes a value-block definition; it does not short-close a node use. So an inner node left open inside a body is never closed by !! and you get E_UNCLOSED_NODE. Close inner nodes with their own name@.

Seam 2 — an injected node still needs its closer.

A bare @inset on its own line opens a block that expects inset@; if the surrounding body closes first, it hits the wrong closer — E_MISMATCHED_CLOSE. A script that injects rendered content must supply balanced open/close, not a half-open node.

Common mistakes

  • Using !! to close a node use — it closes a value-block definition only.
  • Expecting a script-injected node to auto-close — supply its name@.

See also

Iteration

· Conditionals · Interpolation & captures · Multi-file references · Derived content · Gotchas