PLOGHELP FAST_SETOF                    Jonathan Laventhol, 15 July 1983.
                                Revised by Kathryn Seifert  October 1986

Produces a set of patterns which will satisfy a given goal

    ?- fast_setof(Patterns, Goal, Set).

Keywords: goal, goal satisfaction, set


A builtin predicate for getting a list of the solutions to a goal.  It
is like 'setof' (see PLOGHELP * SETOF), but you cannot backtrack on
solutions where variables appearing in Goal do not occur in Pattern.

In a query of the form:

    ?- fast_setof(Ma, parents(Pa, Ma, Child), S).

'fast_setof' will treat the meaning of this query as "B is the set of
all Mas such that Pa and Ma are the father and mother of Child for ANY
Pa and Child".

For example, given the database of facts:

    parents(frances, richard, kathy).
    parents(elsie, mel, jon).
    parents(joanne, kenny, frank).

we can call 'fast_setof' as above with the following results:

    ?- fast_setof(Ma, parents(Ma, Pa, Child), S).
    Ma = _1
    Pa = _2
    Child = _3
    S = [elsie, frances, joanne]
    ? 
    yes

Compare with * FAST_BAGOF, * SETOF, and * BAGOF.

-- RELATED DOCUMENTATION ----------------------------------------------

PLOGHELP * BAGOF
 Produces a bag of patterns which will satisfy a given goal

PLOGHELP * SETOF
 Produces a set of patterns which will satisfy a given goal

PLOGHELP * FAST_BAGOF
 Fast version of 'bagof'

PLOGHELP * FINDALL
 Library program to find all the terms which satisfy a given predicate
