Note that there are some explanatory texts on larger screens.

plurals
  1. POHow does clojure's syntax-quote work?
    primarykey
    data
    text
    <p>Various special characters in clojure are abbreviations for things</p> <p><code>(quote (a b))</code> is the same as <code>'(a b)</code></p> <p>as you can see by evaluating:</p> <pre><code>user&gt; ''(a b) (quote (a b)) </code></pre> <p>This seems to be syntax as abbreviation, which strikes me as a fine idea.</p> <p>But the syntax-quote, ` , seems special. I can't think what would be equivalent to </p> <pre><code>`(a b) </code></pre> <p>I would have guessed something like <code>(syntax-quote (a b))</code> , but it doesn't work, and if I've just guessed wrong, I can't find out what it's really called.</p> <pre><code>user&gt; '`(a b) (clojure.core/seq (clojure.core/concat (clojure.core/list (quote user/a)) (clojure.core/list (quote user/b)))) </code></pre> <p>Is a bit mystifying.</p> <p>Presumably the reader's doing something special, maybe because it needs to know the namespaces?</p> <p>Interestingly, the special syntax used in the syntax-quote does work as I expected:</p> <pre><code>user&gt; '~a (clojure.core/unquote a) user&gt; '~@a (clojure.core/unquote-splicing a) user&gt; '~'a (clojure.core/unquote (quote a)) </code></pre> <p>except for this one:</p> <pre><code>user&gt; 'a# a# </code></pre> <p>Which I would have thought produced something like <code>(unquote (gensym "a"))</code></p> <p>I do realise that I'm being a bit feeble here, and should just go and read the code. If no-one fancies explaining what's going on or giving a reference, can anyone give me a hint about how to find the relevant code and what to look for?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload