Re: calling a clojure function within a quote/(')

2017-11-18 Thread Dustin Getz
Here is my attempt at gymnastics, exploits that < does indeed resolve to clojure.core/< in datomic query: (def c 5) [:find '?e :where ['?e :db/ident] [`(< ~'?e ~c)]]=> [:find ?e :where [?e :db/ident] [(clojure.core/< ?e 5)]] (d/q [:find '?e :where ['?e :db/ident] [`(<

Re: calling a clojure function within a quote/(')

2017-11-18 Thread Dustin Getz
I wouldn't try to fight this battle, just parameterize the query [:find ?e :in $ ?three :where [? :data/number ?number] [(> ?number ?three)]] http://docs.datomic.com/best-practices.html#parameterize-queries *Datomic will cache queries, so long as the query (first) argument data structures ev

Re: calling a clojure function within a quote/(')

2017-11-18 Thread Alex Baranosky
Also: (cond-> query true (conj ['? :data/number '?number]) true (conj [(list '> '?number (foo 2))])) ;; => [:find ?e :in $ :where w [? :data/number ?number] [(> ?number 3)]] On Fri, Nov 17, 2017 at 8:44 PM, Matching Socks wrote: > In the docs: "syntax quote" on https://clojure.

Re: calling a clojure function within a quote/(')

2017-11-17 Thread Matching Socks
In the docs: "syntax quote" on https://clojure.org/reference/reader -- 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 y

Re: calling a clojure function within a quote/(')

2017-11-17 Thread Armando Blancas
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

calling a clojure function within a quote/(')

2017-11-17 Thread Njab Soul
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