bagof(V, P, L)

Find  all  all  terms,  V,  such  that P is true.  Append V to the list, L.
Bagof  uses  backtracking  to find all the solutions to P.  [Note:  This is
the  same  as  Prolog-10's  bagof  predicate except that the additional "^"
notation  for  existentially  quantified  variables  is  not required.  All
unbound variables in P are assumed to be existentially quantified].
