[ISO]:Condition -> :ActionIf-then and If-Then-Else. The ->/2
construct commits to the choices made at its left-hand side, destroying
choice points created inside the clause (by ;/2),
or by goals called by this clause. Unlike !/0,
the choice point of the predicate as a whole (due to multiple clauses)
is not destroyed. The combination ;/2
and ->/2 acts as
if defined as:
If -> Then; _Else :- If, !, Then.
If -> _Then; Else :- !, Else.
If -> Then :- If, !, Then.
Please note that (If
-> Then) acts as (If
fail), making the construct fail if the condition fails.
This unusual semantics is part of the ISO and all de-facto Prolog