My first Clojure macro

2012-05-27

is macro?:

(defmacro macro? [form]
    "Return true if form is a macro."
    `(:macro (meta #'~form) false))

Use case: I am new to the language, and don't know yet when to quote arguments. With macro? and the REPL it's quick to learn. Example:

user=> (macro? macro?)
true
user=> (macro? next)
false

It's funny that to operate on macros you need a (read-time) macro.