11.3.149 ;/2 [ISO]

Synopsis

+P ; +Q

Disjunction: Succeeds if P succeeds or Q succeeds.

+P -> +Q ; +R

If P then Q else R, using first solution of P only.

Arguments

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

Description

These are normally regarded as part of the syntax of the language, but they are like a built-in predicate in that you can write call((P ; Q)) or call((P -> Q ; R)).

The character ‘|’ (vertical bar) can be used as an alternative to ‘;’.

The operator precedences of the ‘;’ and ‘->’ are both greater than 1000, so that they dominate commas.

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

Backtracking

For the if-then-else construct: if P succeeds and Q then fails, backtracking into P does not occur. A cut in P does not make sense. ‘->’ acts like a cut except that its range is restricted to within the disjunction: it cuts away R and any choice points within P. ‘->’ may be thought of as a “local cut”.

Exceptions

Call errors (see ref-sem-exc).

See Also

ref-sem.


Send feedback on this subject.