\+Condition, Else). In other words, if Condition succeeds at least once, simply behave as the conjunction of Condition and Action, otherwise execute Else. The construct is known under the name if/3 in some other Prolog implementations.
The construct A
*-> B, i.e.,
Else branch, is translated as the normal conjunction A,
implemented by clause/2
returns this construct as a normal conjunction too.
This construct is rarely used. An example use case is the implementation of optional in sparql. The optional construct should preserve all solutions if the argument succeeds as least once but still succeed otherwise. This is implemented as below.
optional(Goal) :- ( Goal *-> true ; true ).
Now calling e.g.,
optional(member(X, [a,b])) has the
X=a and X=b, while
succeeds without binding X.