11.3.73 ^/2

Synopsis

+X ^ +P

Equivalent to “there exists an X such that P is true”, thus X is normally an unbound variable. The use of the explicit existential quantifier outside setof/3 and bagof/3 is superfluous.

Arguments

X
term
:P
callable, must be nonvar

Description

Equivalent to simply calling P.

Backtracking

Depends on P.

Exceptions

Call errors (see ref-sem-exc).

Examples

Using bagof/3 without and with the existential quantifier:

     | ?- bagof(X, foo(X,Y), L).
     
     X = _3342,
     Y = 2,
     L = [1,1] ;
     
     X = _3342,
     Y = 3,
     L = [2] ;
     
     no
     
     | ?- bagof(X, Y^foo(X,Y), L).
     
     X = _3342,
     Y = _3361,
     L = [1,1,2] ;
     
     no

See Also

setof/3, bagof/3, ref-all.


Send feedback on this subject.