Skip to content
Clojure's syntax-quote reader macro as a normal macro
Branch: master
Clone or download
Latest commit b927924 May 31, 2015
Type Name Latest commit message Commit time
Failed to load latest commit information.
test Handle unknown class names May 31, 2015
.gitignore Publish 0.3.0 Jun 20, 2013


A Clojure library providing the syntax-quote (aka quasiquote) reader macro as a normal macro.


Clojure's backtick ` reader macro, called syntax-quote, complects the templating of Clojure forms with Clojure's namespaced symbol resolution.

Backtick allows you to use the unquote ~ and unquote-splicing ~@ metacharacters for templating forms with or without a custom symbol resolver.

Lots more background at


Artifacts are hosted on Clojars:


(use 'backtick)

;; Full syntax-quote replacement
(let [x 5 v [:a :b]]
  (syntax-quote {:x ~x, s #{~@v "c" inc}}))

;; Returns:
{:x 5, user/s #{"c" clojure.core/inc :a :b}}

;; Templating only, no symbol resolution
(let [x 5 v [:a :b]]
  (template {:x ~x, s #{~@v "c" inc}}))

;; Returns:
{s #{"c" :a :b inc}, :x 5}

Note that while template does not resolve symbols, it does support gensyms:

(template [x# x# y#])

;; Returns something like:
[x__auto__990 x__auto__990 y__auto__991]

You can create a templating macro with a custom resolver by using defquote:

(defquote shout-quote (comp symbol clojure.string/upper-case))

(shout-quote {:foo bar})

;; Returns:
{:foo BAR}

Corresponding functions are generated for every quoting macro:

(syntax-quote-fn 'foo) ;; => (quote user/foo)
(template-fn 'foo)     ;; => (quote foo)
(shout-quote-fn 'foo)  ;; => (quote FOO)


Copyright © 2012 Brandon Bloom

Distributed under the Eclipse Public License, the same as Clojure.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.