11.3.102 ->/2 [ISO]

Synopsis

+P -> +Q

When occurring other than as the first argument of a disjunction operator (;/2), this is equivalent to:

     P -> Q ; fail.

Arguments

:P
callable, must be nonvar
:Q
callable, must be nonvar

Description

This is not normally regarded as a built-in predicate, since it is part of the syntax of the language. However, it is like a built-in predicate in that you can say call((P -> Q)).

->’ cuts away any choice points in the execution of P

Note that the operator precedence of ‘->’ is greater than 1000, so it dominates commas. Thus, in:

     f :- p, q -> r, s.
     f.

->’ cuts away any choices in p or in q, but unlike cut (!) it does not cut away the alternative choice for f.

Cuts in P do not make sense, but they are allowed, their scope being the goal P. The scope of cuts in Q extends to the containing clause.

Backtracking

Depends on Q.

Exceptions

Call errors (see ref-sem-exc).

See Also

ref-sem.


Send feedback on this subject.