Learn the core Clojure metaprogramming model: code as data, forms as ordinary values, and macros as controlled transformations from one form to another.
Clojure metaprogramming starts with one idea: code is represented with ordinary Clojure data structures. A macro is not magic; it is a transformation from caller forms to generated forms.
| Concept | Java engineer’s translation |
|---|---|
| Form | A piece of source represented as data. |
| Quote | Keep a form as data instead of evaluating it. |
| Syntax quote | Build a generated form with safer symbol resolution. |
| Macro | Expansion-time code that returns code. |
This subsection focuses on the data model behind macros, when macros are the right metaprogramming tool, and examples that stay small enough to review.