Skip to main content

Module magic

Module magic 

Source
Expand description

lux magic — spells for things you want to do now.

Where lux learn is a concept ladder (“what is X?”), magic is task indexed (“how do I X?”). A spell is a small, runnable program that already works, plus a trail to the lux learn topics that explain the ideas it uses. Spells are allowed to run ahead of where a reader has climbed the learn ladder — that is the point: a working shape now, with an honest signpost to where the trick is explained. The same spell reads as plain lux once its trail is climbed; the magic was never magic.

The content lives in magic-lux.md, baked in at compile time, and is also the test corpus: every spell is real lux the suite runs and translates.

Structs§

Spell
One spell: the join key id, a short title, the “how do I…?” question, a runnable example, and the learn topics that explain it.

Functions§

lookup
Resolve lux magic <id> to its rendered spell.
menu
lux magic with no argument: the spells on offer, each a “how do I…?”.
spells
Parse every <!-- spell: id --> block in document order.