if/3
if(
+P,
+Q,
+R)
If P then Q else R, for all solution of P.
Analogous to
if P then Q else R
but differs from P -> Q ; R
in that if(P, Q, R)
explores
all solutions to the goal P. There is a small time
penalty for this—if P is known to have only one solution of
interest, the form P -> Q ; R
should be preferred.
This is normally regarded as part of the syntax of the language, but
it is like a built-in predicate in that you can write
call(if(P,Q,R))
.
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.
Depends on the arguments.
Call errors (see ref-sem-exc).