findall/3

Returns unsorted list of terms in solutions of a given goal

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

?Term <term>

+Goal <goal>

?List <variable> or <list>

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

This predicate returns an unsorted list of solutions that would normally be obtainable only by failing and backtracking through a query. It succeeds if List can be unified to a list of all 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

setof/3

findall/3 is nowadays a standard Prolog predicate. The implementation of findall/3 in G.I.S. Prolog is efficient and robust; any expression may be used as the second argument, including expressions that contain disjunctions.