Fork me on GitHub
#datomic
<
2023-03-23
>
Gustavo A.02:03:20

Hi, is there a way to use a pull expression when using a query map, eg:

(d/q {:query '{:find [(pull ?r ?pattern)]
               :in   [$ ?name ?category ?pattern]
               :where ...
         :args [db "home" "shopping" '[*]']})     
I have tried in different ways and I get an error every time. All the examples I have found so far use the form:
(d/q '[:find (pull ?r ?pattern)
               :in   $ ?name ?category ?pattern
               :where ...]
         db "home" "shopping" '[*]) 
I’m on cloud

favila04:03:40

(d/q {:query '{:find [(pull ?r pattern)]
               :in   [$ ?name ?category pattern]
               :where ...
         :args [db "home" "shopping" '[*]]})     

favila04:03:49

note it’s pattern not ?pattern

favila04:03:32

(also you had a stray ' at the end-- I assume that was just a typo)

Gustavo A.11:03:36

yup, it was a typo

Gustavo A.11:03:14

and yes, that was the problem, is pattern without the question mark :face_palm: silly mistake, I’m not sure why I put it that way

Gustavo A.11:03:22

thank you! 🙇