[not loaded]PublicShow sourcebags.pl

Source findall(-Var, +Goal, -Bag) is det
Source findall(-Var, +Goal, -Bag, +Tail) is det
Bag holds all alternatives for Var in Goal. Bag might hold duplicates. Equivalent to bagof, using the existence operator (^) on all free variables of Goal. Succeeds with Bag = [] if Goal fails immediately.

The findall/4 variation is a difference-list version of findall/3.

Source findnsols(+Count, @Template, :Goal, -List) is nondet
Source findnsols(+Count, @Template, :Goal, -List, ?Tail) is nondet
True when List is the next chunk of maximal Count instantiations of Template that reprensents a solution of Goal. For example:
?- findnsols(5, I, between(1, 12, I), L).
L = [1, 2, 3, 4, 5] ;
L = [6, 7, 8, 9, 10] ;
L = [11, 12].
Errors
- domain_error(not_less_than_zero, Count) if Count is less than 0.
- type_error(integer, Count) if Count is not an integer.
Compatibility
- Ciao, but the SWI-Prolog version is non-deterministic.
Source bagof(+Var, +Goal, -Bag) is semidet
Implements Clocksin and Melish's bagof/3 predicate. Bag is unified with the alternatives of Var in Goal, Free variables of Goal are bound, unless asked not to with the existential quantifier operator (^).
Source setof(+Var, +Goal, -Set) is semidet
Equivalent to bagof/3, but sorts the resulting bag and removes duplicate answers. We sort immediately after the findall/3, removing duplicate Templ-Answer pairs early.

Undocumented predicates

The following predicates are exported, but not or incorrectly documented.

Source findall(Arg1, Arg2, Arg3, Arg4)
Source findnsols(Arg1, Arg2, Arg3, Arg4, Arg5)