Is it possible to perform a nested query? Datomic docs says that it has a q function. Does DataScript have something similar? I tried :where [(q ‘[:find …]) ?result] but that gives me an “Unknown function 'q” error message.
My goal is to do something like the following:
#+BEGIN_QUERY
;; Find all incomplete tasks due the same day
;; as the journal page containing this query.
{
:query [
:find (pull ?b [*])
:in $ ?journal-page
:where
[?b :block/marker ?marker]
[(not= ?marker "DONE")]
[(not= ?marker "CANCELED")]
[(not= ?marker "CANCELLED")]
[?b :block/deadline ?dl]
[(q '[
:find ?d
:in $ ?journal-page
:where
[?p :block/name ?journal-page]
[?p :block/journal? true]
[?p :block/journal-day ?d]
] $ ?journal-page) [[?d]]]
[(= ?dl ?d)]
]
:inputs [:query-page]
}
#+END_QUERY
Perhaps there is an alternative way to accomplish this goal?