Learn how Clojure turns macro calls into ordinary code before evaluation, and how Java engineers can inspect that generated code instead of guessing.
Macro expansion is the step where Clojure replaces a macro call with the code returned by the macro. If a macro feels mysterious, expand it.
For Java engineers, the best analogy is generated source: the compact macro call is not the final thing to review. The expansion is.
| Tool | Use it when |
|---|---|
macroexpand-1 |
You want to see the next transformation only. |
macroexpand |
You want to keep expanding until the outer form is no longer a macro call. |
| A small diagram or trace table | The generated code is easier to review as a before/after sequence. |
This subsection focuses on reading expansion output, choosing the right expansion tool, and reviewing macro transformations before they become team abstractions.