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: Map Keys are functions, why not vector elements?

2017-11-18 Thread Alex Baranosky
Practically speaking, Java numbers cannot be extended with the IFn interface to make this possible. On Mon, Nov 13, 2017 at 9:15 AM, Alex Miller wrote: > Regarding the title, this is incorrect. Map keys are not functions; > keywords are functions that take an associative data structure and will

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.