setof

setof/3

return sorted sets of terms in solutions of a given goal

setof( Term, Goal, List )

?Term <term>

+Goal <goal>

?List <variable> or <list>

This predicate returns sorted sets of solutions that would normally be obtainable only by failing and backtracking through a query. It succeeds if List can be unified to a non-empty list of instances of Term such that Goal is true. The Term may be any Prolog term, and Goal may be any Prolog goal.

See Also

bagof/3

findall/3