user=> (cond-> query

  #_=>     true

  #_=>     (conj '[? :data/number ?number])

  #_=>     true

  #_=>     (conj `[(~'> ~'?number ~(foo 2))]))

[:find ?e :in $ :where [? :data/number ?number] [(> ?number 3)]]


On Friday, November 17, 2017 at 6:15:18 AM UTC-8, Njab Soul wrote:
>
> Hi guys I need your help.
>
> I want to make a clojure query, but the :where conditions are condition. 
> SO i used cond->.
> this works well. but now my problem is that I want to make a clojure 
> function call inside a (') or quote.
>
>
> (defn foo [num]
>
>   (inc num))
>
> (def query '[:find ?e
>               :in $
>               :where ])
>
> (cond-> query
>     (some-condition) 
>     (conj '[? :data/number ?number])
>     (some-other-condition)
>     (conj `[~'(> ?number ~(foo 2))]))
>
>
> I get this result:
> [:find ?e 
>   :in $ 
>   :where [? :data/number ?number] 
>   [(> ?number (clojure.core/unquote (foo 2)))]]
>
>
> What I am trying to achieve is this:
>
> [:find ?e 
>   :in $ 
>   :where [? :data/number ?number] 
>   [(> ?number 3)]]
>
>
> Can anyone please help
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to