Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Output modifiers

Output modifiers are block elements that transform the caller's current output before the modifier's own result is written back.

The @edit operator

@edit consumes the caller's current output, optionally binds it to a local name, and replaces it with the modifier body.

"example" { @edit x: `<x> `<x> }
example example

If no binding name is supplied, the previous output is discarded and only the modifier result is kept.

"example" { @edit: "overwritten" }
overwritten

Placement rules

@edit must appear at the start of a block element. Misplaced @edit is a compile-time error.

Example: accumulating across repeats

[%factorial: n] {
  1 [rep: <n>] {@edit x: <x> * [step]}
}

[factorial: 6]
720