title: How to write a macro used in cond in clojure?
body: <p>I have the following macro to ensure the data containing specific keys.</p>
  
  <pre><code>(defmacro with-correct-format
    [data &amp; body]
    `(cond
      (nil? ~data) (throw (IllegalArgumentException.
                          "input data cannot be nil"))
      (nil? (:first-name data)) (throw (IllegalArgumentException.
                                "first name cannot be nil"))
      (nil? (:last-name data)) (throw (IllegalArgumentException.
                               "last name cannot be nil"))
      :else ~@body))
  </code></pre>
  
  <p>I want to refactor this code by extracting the <code>(nil? (:key data))</code> condition. I tried this one but not working:</p>
  
  <pre><code>(defmacro key?
    [key-name data]
    `((nil? (~key-name ~data)) (throw (IllegalArgumentException.
                               "cannot be nil"))))
  </code></pre>
  
  <p>What should I do?</p>