next up previous index
Next: Matching Clauses Up: Special Primitives Previous: Special Primitives

Soft Cut

Sometimes it is useful to be able to remove a choice point which is not the last one and to keep the following ones, for example when defining an if-then-else construct which backtracks also into the condition. This functionality is usually called soft cut in the Prolog folklore.

When you define the operator     op(1050, xfx, ) and import /2 from sepia_kernel, then the expression

A B ; C
is evaluated as a soft cut: if A succeeds, B is executed and on backtracking subsequent solutions of A are returned, but C is never executed. If A fails, C is executed. It is similar to ->/2, with the exception that ->/2 cuts both A and the disjunction if A succeeds, whereas /2 cuts only the disjunction.



Micha Meier
Mon Mar 4 12:11:45 MET 1996