Why does this clojure macro need `'~?
<p><em>(Apologies if this is a duplicate of another question, my search for all those fancy special characters didn't yield anything.)</em></p>

<p>I'm reading <a href="https://pragprog.com/book/cjclojure/mastering-clojure-macros" rel="nofollow">Mastering Clojure Macros</a> and have trouble understanding the following example:</p>

<pre><code>(defmacro inspect-caller-locals []
  (-&gt;&gt; (keys &amp;env)
       (map (fn [k] [`'~k k]))
       (into {})))
=&gt; #'user/inspect-caller-locals
(let [foo "bar" baz "quux"]
  (inspect-caller-locals))
=&gt; {foo "bar", baz "quux"}
</code></pre>

<p>What is the difference between the following and the much simpler <code>'k</code>?</p>

<pre><code>`'~k
</code></pre>

<p>As far as I understand, the innermost unquote <code>~</code> should simply reverts the effect of the outermost syntax-quote `, but a short experiment reveals that there's more to it:</p>

<pre><code>(defmacro inspect-caller-locals-simple []
  (-&gt;&gt; (keys &amp;env)
       (map (fn [k] ['k k]))
       (into {})))
=&gt; #'user/inspect-caller-locals-simple
(let [foo "bar" baz "quux"]
  (inspect-caller-locals-simple))
CompilerException java.lang.RuntimeException: Unable to resolve symbol: k in this context, compiling:(/tmp/form-init4400591386630133028.clj:2:3) 
</code></pre>

<p>Unfortunately, my usual investigation approach doesn't apply here:</p>

<pre><code>(macroexpand '(let [foo "bar" baz "quux"]
                 (inspect-caller-locals)))
=&gt; (let* [foo "bar" baz "quux"] (inspect-caller-locals))
(let [foo "bar" baz "quux"]
  (macroexpand '(inspect-caller-locals)))
=&gt; {}
</code></pre>

<p>What am I missing here?</p>