datalog: findall aggregate (159/159)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 53s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 53s
(findall L V Goal) — bind L to the distinct V values for which Goal holds, or the empty list when none. One-line addition to dl-do-aggregate that returns the unreduced list. Tests cover EDB, derived relation, and empty cases. Useful for "give me all the X such that ..." queries without scalar reduction.
This commit is contained in:
@@ -186,9 +186,10 @@ large graphs.
|
||||
|
||||
### Phase 8 — aggregation (Datalog+)
|
||||
- [x] `(count R V Goal)`, `(sum R V Goal)`, `(min R V Goal)`,
|
||||
`(max R V Goal)` — first arg is the result variable, second is the
|
||||
aggregated variable, third is the goal literal. Live in
|
||||
`lib/datalog/aggregates.sx`.
|
||||
`(max R V Goal)`, `(findall L V Goal)` — first arg is the result
|
||||
variable, second is the aggregated variable, third is the goal
|
||||
literal. `findall` returns the distinct-value list itself; the
|
||||
others reduce. Live in `lib/datalog/aggregates.sx`.
|
||||
- [x] `dl-eval-aggregate`: runs `dl-find-bindings` on the goal under the
|
||||
current subst (which provides outer-context bindings), collects
|
||||
distinct values of the aggregated var, applies the aggregate.
|
||||
@@ -269,6 +270,13 @@ large graphs.
|
||||
|
||||
_Newest first._
|
||||
|
||||
- 2026-05-08 — Phase 8 extension: `findall L V Goal` aggregate. Bind
|
||||
L to the list of distinct V values for which Goal holds (or the
|
||||
empty list when no matches). Implemented as a one-line case in
|
||||
`dl-do-aggregate`. 3 new tests: EDB, derived relation, empty.
|
||||
Useful for "give me all the X such that …" queries without
|
||||
scalar reduction.
|
||||
|
||||
- 2026-05-08 — Phase 5d semantic fix: anonymous `_` variables are
|
||||
renamed per occurrence at `dl-add-rule!` and `dl-query` time so
|
||||
`(p X _) (p _ Y)` no longer unifies the two `_`s. New helpers
|
||||
|
||||
Reference in New Issue
Block a user