Skip to main content

Macros

  • #""

    Regex literal. #"pattern" compiles to java.util.regex.Pattern at read time.

  • #'

    Var quote. #'foo resolves to the Var object itself.

  • #()

    Anonymous function shorthand. #(+ %1 %2) expands to (fn [x y] (+ x y)).

  • #?

    Reader conditional. #?(:clj expr :cljs expr) for .cljc files.

  • #?@

    Splicing reader conditional.

  • #_

    Discard. #_form causes the reader to ignore the next form.

  • #inst

    Tagged literal for instants. #inst "2024-01-01".

  • #uuid

    Tagged literal for UUIDs.

  • #{}

    Set literal. #{1 2 3} creates a persistent hash set.

  • '

    Quote. 'form expands to (quote form).

  • @

    Deref. @ref expands to (deref ref).

  • ^

    Metadata. ^{:k v} form attaches metadata to the next form.

  • `

    Syntax quote. Resolves symbols to fully-qualified names; allows ~ and ~@.

  • ~

    Unquote. Used inside syntax-quoted forms to evaluate an expression.

  • ~@

    Unquote-splicing. Splices a sequence into the surrounding form.

  • apply-template

    For use in macros. argv is an argument list, as in defn. expr is a quoted expression using the symbols in argv. val...

  • definline

    Experimental - like defmacro, except defines a named function whose body is the expansion, calls to which may be expan...

  • defmacro

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

  • do-template

    Repeatedly copies expr (in a do block) for each group of arguments in values. values are automatically partitioned by...

  • gensym

    Returns a new symbol with a unique name. If a prefix string is supplied, the name is prefix# where # is some unique nu...

  • macroexpand

    Repeatedly calls macroexpand-1 on form until it no longer represents a macro form, then returns it. Note neither ma...

  • macroexpand-1

    If form represents a macro form, returns its expansion, else returns form.

  • quote

    Yields the unevaluated form.