Aggregate bindings in Goal according to Template. The
aggregate_all/3 version performs findall/3 on Goal. Note that this
predicate fails if Template contains one or more of min(X)
, max(X)
,
min(X,Witness)
or max(X,Witness)
and Goal has no solutions, i.e.,
the minimum and maximum of an empty set is undefined.
The Template values count
, sum(X)
, max(X)
, min(X)
, max(X,W)
and
min(X,W)
are processed incrementally rather than using findall/3 and
run in constant memory.
- See also
- - foldall/4 to "fold" over all answers.