README code blocks as executable claims. Pure.
A fenced ```clojure block in a markdown file claims that its code runs
against this library, and a ;; => value line after a form claims what
that form answers. blocks finds the claims, examples reads a block into
forms paired with their claimed values, and script renders one Clojure
program that evaluates them in order, names each before it runs, and exits
non-zero when a form throws or answers something else. The program runs in
a cold JVM at the boundary (hive-build.api/readme-examples), never in the
session that wrote the README.
Add no-run to a fence's info string (```clojure no-run) to keep a block
out of the run. Rationale: hive memory 20260907084849-421ab665.
README code blocks as executable claims. Pure. A fenced ```clojure block in a markdown file claims that its code runs against this library, and a `;; => value` line after a form claims what that form answers. `blocks` finds the claims, `examples` reads a block into forms paired with their claimed values, and `script` renders one Clojure program that evaluates them in order, names each before it runs, and exits non-zero when a form throws or answers something else. The program runs in a cold JVM at the boundary (`hive-build.api/readme-examples`), never in the session that wrote the README. Add `no-run` to a fence's info string (```clojure no-run) to keep a block out of the run. Rationale: hive memory 20260907084849-421ab665.
(blocks markdown)Every fenced code block of markdown, in document order, with the 1-based
line of its opening fence. A block still open at the end of the text is
not a block.
Every fenced code block of `markdown`, in document order, with the 1-based line of its opening fence. A block still open at the end of the text is not a block.
(examples {:block/keys [index source run?]})The forms of a runnable block, each verbatim and with the value the README claims for it; nil for a block that is not run. A claim belongs to the LAST form on its line. A block the reader cannot take apart is one example with no claim, so the cold JVM reports the real error.
The forms of a runnable block, each verbatim and with the value the README claims for it; nil for a block that is not run. A claim belongs to the LAST form on its line. A block the reader cannot take apart is one example with no claim, so the cold JVM reports the real error.
A fence's info string: the rest of the opening line, one line by construction.
A fence's info string: the rest of the opening line, one line by construction.
(lang-of info)The language a fence's info string names; "" when it names none.
The language a fence's info string names; "" when it names none.
(markdown blocks)A markdown document holding exactly blocks, each under a line of prose:
the inverse of blocks for their info strings and sources.
A markdown document holding exactly `blocks`, each under a line of prose: the inverse of `blocks` for their info strings and sources.
Fence languages whose blocks are Clojure programs.
Fence languages whose blocks are Clojure programs.
(runnable? lang info)True when a block with this language and info string is part of the run.
True when a block with this language and info string is part of the run.
(script blocks)One Clojure program that evaluates every runnable block's forms in order, names each before it runs, and refutes claims as it goes. Meant for a new JVM: it ends the process with the verdict as its exit code.
One Clojure program that evaluates every runnable block's forms in order, names each before it runs, and refutes claims as it goes. Meant for a new JVM: it ends the process with the verdict as its exit code.
Word in a fence's info string that keeps the block out of the run.
Word in a fence's info string that keeps the block out of the run.
A block body: lines that never close the fence, split on newlines only.
A block body: lines that never close the fence, split on newlines only.
(summary blocks)How much a document claims: blocks found, run, kept out, and claimed values.
How much a document claims: blocks found, run, kept out, and claimed values.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |