rule --> if conjunction then conclusion.
rule
--> if conjunction then conclusion except
rule.
rule --> if conjunction then
conclusion else rule.
conjunction --> condition.
conjunction -->
condition and conjunction.
condition --> any Prolog predicate
conclusion --> term
conclusion --> term because term
term --> any Prolog term
RDR's are essentially if-then-else statements that return values, eg.
X is if 1 == 2 then 2+3 else 4*5?
X = 20
That is, if is a function. Note that the result in the then part of the statement is evaluated.
The except part of the rule is evaluate if the conjunction of conditions succeeds, eg.
X is if 1 == 1 then 2+3 except if 2 < 3 then 4*5?
X = 20
In this case, the result of the except part over-rides the original conclusion.
Associativity |
Precedence |
Operator |
---|---|---|
960 |
fx |
if |
950 |
xfx |
else |
850 |
xfx |
then |
840 |
xfx |
except |
830 |
xfx |
because |
800 |
xfy |
or |
750 |
xfy |
and |