syntax | since v0.0-1853 | in clojure | Edit |
Like ~ unquote
, except the result is spliced (i.e. [a b]
=> a b
)
`(foo ~@x)
=> (cljs.user/foo a b)
(if x is [a b])(def foo '[a b c])
`(~@foo)
;;=> (a b c)
(defn- read-unquote
[rdr comma opts pending-forms]
(if-let [ch (peek-char rdr)]
(if (identical? \@ ch)
((wrapping-reader 'clojure.core/unquote-splicing) (doto rdr read-char) \@ opts pending-forms)
((wrapping-reader 'clojure.core/unquote) rdr \~ opts pending-forms))))
(defn- macros [ch]
(case ch
\" read-string*
\: read-keyword
\; read-comment
\' (wrapping-reader 'quote)
\@ (wrapping-reader 'clojure.core/deref)
\^ read-meta
\` read-syntax-quote ;;(wrapping-reader 'syntax-quote)
\~ read-unquote
\( read-list
\) read-unmatched-delimiter
\[ read-vector
\] read-unmatched-delimiter
\{ read-map
\} read-unmatched-delimiter
\\ read-char*
\% read-arg
\# read-dispatch
nil))