Exceptions: Same as predicate call/1 (see Section 6.8).
Exceptions: Same as predicate call/1 (see Section 6.8).
Exceptions: Same as predicate call/1 (see Section 6.8).
Note: tfindall/3 may be deprecated in current versions. Please use the predicates described in Section 6.6.1 if possible.
Like findall/3, tfindall/3 treats all variables in Goal that do not occur in X as existential. However, in tfindall/3, the Goal must be a call to a single tabled predicate.
tfindall/3 allows the user to build programs that use stratified aggregation. If the table to Goal is incomplete, tfindall/3 suspends until the table has been completed, and only then computes List. See Chapter 5 for further discussion of tfindall/3. Like findall/3, if Goal is unsatisfiable, tfindall/3 succeeds binding List to the empty list.
Some of the differences between predicates findall/3 and tfindall/3 can be seen from the following example:
| ?- [user].
[Compiling user]
:- table p/1.
p(a).
p(b).
[user compiled, cpu time used: 0.639 seconds]
[user loaded]
yes
| ?- p(X), findall(Y, p(Y), L).
X = a
Y = _922928
L = [a];
X = b
Y = _922820
L = [a,b];
no
| ?- abolish_all_tables.
yes
| ?- p(X), tfindall(Y, p(Y), L).
X = b
Y = _922820
L = [b,a];
X = a
Y = _922820
L = [b,a];
no
Exceptions: Same as predicate findall/3 (see above). Also:
Note: tbagof/3 and tsetof/3 may be deprecated in current versions. Please use the predicates described in Section 6.6.1 if possible.
The standard predicates tbagof/3 and tsetof/3 provide tabled versions of bagof/3 and setof/3 in a similar manner to the way in which tfindall/3 provides a tabled version of findall/3.