title: Clojure macros: quoting and syntax quoting
body: <p>Say I have the following code:</p>
  
  <pre><code>(defmacro test1 [x]
    (list 'fn '[y]
          (if (pos? x)
            '(println y)
            '(println (- y)))))
  </code></pre>
  
  <p>It does what I need, composes a function based on x, and leaves no references to x. For example, <code>(test1 1)</code> macroexpands into <code>(fn* ([y] (println y)))</code>.</p>
  
  <p>Now, I'd like to rewrite it using syntax quoting. This is what I have so far:</p>
  
  <pre><code>(defmacro test2 [x]
    `(fn [y#]
       (if ~(pos? x)
         (println y#)
         (println (- y#)))))
  </code></pre>
  
  <p>This does exactly the same, with one exception: it leaves an <code>(if true ..)</code> expression in the expanded expression:</p>
  
  <p><code>(fn* ([y__12353__auto__] 
     (if true 
       (clojure.core/println y__12353__auto__) 
       (clojure.core/println (clojure.core/- y__12353__auto__)))))</code></p>
  
  <p>This might not be an issue if the compiler can optimize it out. Still, is there a way I could omit it?</p>