:Condition/0¶
0:Condition* -> 0:Action is iso
If Condition has a solution, call _Action__;
@long Read as "if-then-else" or "commit". This operator is similar to the conditional operator of imperative languages and can be used alone or with an else part as follows:
+P -> +Q
"if P then Q".
+P -> +Q; +R
"if P then Q else R".
These two predicates could be defined respectively in Prolog as:
(P -> Q) :- P, !, Q.
and
(P -> Q; R) :- P, !, Q.
(P -> Q; R) :- R.
if there were no "cuts" in P, Q and R.
vNote that the commit operator works by "cutting" any alternative solutions of P.
Note also that you can use chains of commit operators like:
P -> Q ; R -> S ; T.
Note that (->)//22
does not affect the scope of cuts in its arguments.