Clojure Tutorial: Macro

By Xah Lee. Date:

This page is WORK IN PROGRESS.

Clojure has a thing called “macro”. It is like defn for defining a function. Except, it is used as a syntactic transformation. When a macro is defined, the compiler makes a note of it. When a macro is called, the compiler actually calls the transformed function.

Like defn, but the resulting function name is declared as a macro and will be used as a macro by the compiler when it is called.

clojure.core/defmacro

clojure.core/macroexpand

clojure.core/macroexpand-1

reference

If you have a question, put $5 at patreon and message me.

Clojure

  1. Clojure Install
  2. Leiningen Basics
  3. Emacs CIDER
  4. Doc Lookup, Find f

  1. Clojure Basics
  2. List, Map, …
  3. Functions
  4. Function Chaining
  5. Partial Function
  6. Binding Form
  7. regex
  8. Namespace
  9. metadata
  10. macro
  11. Calling Java
  12. Magic Chars '\@^#`~.

misc