[not loaded]bags.pl
- findall(-Var, +Goal, -Bag) is det
- 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.
- findnsols(+Count, @Template, :Goal, -List) is nondet
- 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].
- 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 (^).
- 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.
- bind_bagof_keys(+VarsTemplPairs, -SharedVars)[private]
- Establish a canonical binding of the vars structures. This code was added by Ulrich Neumerkel in commit 1bf9e87900b3bbd61308e80a784224c856854745.
- 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 ==.
- 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.