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.
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.
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.