[not loaded]All predicatesShow 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 cleanup_bag(:Goal, :Cleanup)[private]
Variant of setup_call_cleanup/3 that using '$new_findall_bag'/0 directly instead of through sig_atomic/1.
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 alloc_bind_key_list(+Vars, -VDict) is det[private]
Pre-allocate the variable dictionary used by bind_bagof_keys/2. By pre-allocating this list all variables bound become references from the Vars of each answer to this dictionary. If we do not preallocate we create a huge reference chain from VDict through each of the answers, causing serious slowdown in the subsequent keysort.

The slowdown was discovered by Jan Burse.

Source bind_bagof_keys(+VarsTemplPairs, -SharedVars)[private]
Establish a canonical binding of the vars structures. This code was added by Ulrich Neumerkel in commit 1bf9e87900b3bbd61308e80a784224c856854745.
Source pick_first(+Bags, +Vars, -Bag1, -RestBags) is semidet[private]
Pick the first result-bag from the list of Templ-Answer. Note that we pick all elements that are equal under =@=, but because the variables in the witness are canonized this is the same as ==.
Arguments:
Bags- List of Templ-Answer
Vars- Initial Templ (for rebinding variables)
Bag1- First bag of results
RestBags- Remaining Templ-Answer
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)