Browse Clojure Foundations for Java Developers

Understanding Metaprogramming in Clojure

Learn what macros really do: transform code forms before evaluation, and debug them with macroexpand.

Metaprogramming in Clojure is practical because code is data. You can represent code as lists and transform it before it runs.

This section focuses on the macro mental model: macros operate on forms, not values. You’ll learn why that matters, when it helps, and how to debug macro behavior using expansion tools instead of guessing.

Java mental model: this is closer to compile-time code generation or AST transforms than to runtime reflection.

In this section

Revised on Friday, April 24, 2026