next up previous contents
Next: if ... then Up: Side Effect Programming Previous: The cut (!/0)

;/2

The predicate ;/2 is defined as an infix operator. It is used to express disjunctive subgoals. For example, member/2 can be rewritten as:

 
member(X,[HT]):-

(

X=H

;

member(X,T)

).

The semantics of ;/2 are roughly equivalent to logical or. Best to avoid its use.

The predicate definition

 
a:- b ; c.

is better written as:
 
a:- b.

a:- c.

If you do use this construct then avoid nesting it deeply as this makes code very hard to read and understand.



Paul Brna
Mon May 24 20:14:48 BST 1999