Join Nostr
2025-05-29 17:48:52 UTC
in reply to

Panicz Maciej Godek on Nostr: nprofile1q…kczkz You have a reader that returns s-expressions, and before ...



You have a reader that returns s-expressions, and before evaluating or compiling an s-expression you check whether the first symbol is a name of a macro, and if so, you apply the transformer function to the form before passing it on to the compiler/evaluator.

Of course, a macro can expand to some other macro, so you perform the expansion until it reaches a fixpoint.

In practice you can either expand a whole program, or - if you're running a REPL - you can store macro transformers in the same environment as other values, or have a separate environment for macros.