[query] Allow to bind [(min ?t) ?t0] #270

Open
opened 2020-08-06 16:57:39 +00:00 by gburd · 0 comments
gburd commented 2020-08-06 16:57:39 +00:00 (Migrated from github.com)

Mentat allows to order results; Datomic does not. When expressing "least or greatest in a group" style queries, the fact that we can't manipulate the max or min outside of the find spec is limiting. That is, it's not easy to ask for "the 10 most recently used items" or whatever.

I think we might be able to bind scalars to achieve this. That is, we might find that

:find
 [?e ...]
:where
 [?e :value ?v]
 [(min ?v) ?v0]
:order
 (desc ?v0)
:limit
 10

is generally useful.

Mentat allows to order results; Datomic does not. When expressing "least or greatest in a group" style queries, the fact that we can't manipulate the `max` or `min` outside of the find spec is limiting. That is, it's not easy to ask for "the 10 most recently used items" or whatever. I think we might be able to bind scalars to achieve this. That is, we might find that ``` :find [?e ...] :where [?e :value ?v] [(min ?v) ?v0] :order (desc ?v0) :limit 10 ``` is generally useful.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: greg/mentat#270
No description provided.