Gödel, Escher, Elisp: The Beauty of Macros

In Emacs Lisp, code is data, and macros exploit this dualism to let you extend the language itself. This post explains what homoiconicity really means, shows how ubiquitous macros are (even `defun` is one), and takes a detour through Hofstadter's strange loops and Escher's prints to illustrate the beauty of macros. It also introduces tooling like `macroexpand` and macrostep to help you see through the magic.
A macro receives the body as inert data, so control flow itself is up for grabs.
- meken
> To anticipate a common question: why couldn't my-unless be a function? Function arguments are evaluated eagerly, before the function ever sees them.
Interesting, so if you’re using a lazy language then you don’t need a macro here and could write my-unless as a function.
- kimi
Remember the golden rule of Lisp macros: don't write a macro.
- anthk
The Computational Beauty of Nature it's similar and it has the code of the book there:
Some tools might crash X under CWM for OpenBSD, switch to FVWM or use
some tool like mimalloc.
On Lisp, the book basically builds integers based on conses, kinda like Peano Axioms.
- KeenanKeenan
If macros can implement arbitrary language features then how come elisp has never built a type system?
- thisisauserid
I always thought it odd that Penrose gets dropped from the Escher conversations.