Collecting All Instances

findall/3 is a special case of bagof/3, where all free variables in the generator are taken to be existentially quantified. Thus the use of the operator ^ is avoided. Because findall/3 avoids the relatively expensive variable analysis done by bagof/3, using findall/3 where appropriate rather than bagof/3 can be considerably more efficient.

findall/4 is a variant of findall/3 with an extra argument to which the list of solutions is appended. This can reduce the amount of append operations in the program.

Send feedback on this subject.