setof/3

Returns sorted sets of terms in solutions of a given goal

setof(Term,Goal,List) -(?,i,?)

?Term <term>

+Goal <goal>

?List <variable> or <list>

Compatibility: LPA Win-Prolog, Swindon Prolog, most other prologs.

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