causes that one goal implicates another goal.
If IfGoal succeeds then ThenGoal will be executed.
If IfGoal fails ThenGoal will not be executed.
'->'/2 succeeds if IfGoal and ThenGoal both succeed.
There are two significant differences to ','/2:
'->'/2 is a predefined infix-operator with priority 1050 which is right-associative (see also current_op/3).
IfGoal goal ThenGoal goal
There exists a database with clauses:
colour(blue). colour(yellow).
| colour(X) -> write(X). | Succeeds once with substitution X <- blue and outputs 'blue' to the current outputstream. |
| colour(X) -> X = yellow. | Fails. |
This predicate is part of the ISO-Prolog Standard.