The Story of Mac: A Just-So Story
In this excerpt from Peter Seibel's book on Common Lisp, the author explains macros through a whimsical tale about a programmer named Mac who manually expands code notes, eventually leading to the invention of DEFMACRO. The story clarifies the crucial distinction between macro expansion time and runtime, and the article then details the structure of DEFMACRO and the process of writing macros, emphasizing the need to avoid leaky abstractions.
The key to understanding macros is to be quite clear about the distinction between the code that generates code (macros) and the code that eventually makes up the program (everything else).