title: Clojureql - Can't take value of a macro (clojure)
body: <p>I need to generate the following:</p>
  
  <pre><code>(clojureql.core/join (clojureql.core/table db :tableA) (clojureql.core/table db :tableA)
       (clojureql.core/where (apply and (= :tableA.id :tableB.id)
                        [(apply or [(clojureql.predicates/in :tableA.id [1 2])
                                    (clojureql.predicates/in :tableA.id [3 4])])])))
  </code></pre>
  
  <p>But the "apply or" form needs to be "passed" from another function or macro. Here's what I mean:</p>
  
  <pre><code>(clojureql.core/join (clojureql.core/table db :tableA) (clojureql.core/table db :tableA)
       (clojureql.core/where (apply and (= :tableA.id :tableB.id)
                        [(my-or-f)])))
  </code></pre>
  
  <p>where this function is:</p>
  
  <pre><code>(defn my-or-f []
      (apply or [(clojureql.predicates/in :tableA.id [1 2])
           (clojureql.predicates/in :tableA.id [3 4])]))
  </code></pre>
  
  <p>however this function throws this exception:</p>
  
  <pre><code>#&lt;CompilerException java.lang.Exception: Can't take value of a macro: #'clojure.core/or (NO_SOURCE_FILE:2)&gt;
  </code></pre>
  
  <p>I've also tried using a macro. It compiles but it throws the same exception when I try running the query using this macro</p>
  
  <pre><code>(defmacro my-or-f []
      `(apply or [(clojureql.predicates/in :tableA.id [1 2])
           (clojureql.predicates/in :tableA.id [3 4])]))
  </code></pre>
  
  <p>Is there another way that I could use the "apply or"?</p>
  
  <p>Thanks.</p>