At the top of the clojure.core file (below the comments and the namespace declaration) there are two definitions with no extra code or information:
(def unquote)
(def unquote-splicing)
What do these do/why are they there?
They are kind of dummy values. The reader expands ~x
to (unquote x)
and ~@x
to (unquote-splice x)
. Lists of these types are then handled specially in syntax-quote.
Their declaration allows also their use outside of syntax-quote, e.g. in your own macros.
Since they are not bound to anything, their use outside of syntax-quote or a macro which handles them throws an exception.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With