Alternate
l
Instead of using a conditional expression,
use a third rule with
pattern matching
:
l
member(X, [ ]) => 0;
l
member(X, [X| R]) => 1;
l
member(X, [F| R]) => member(X, R);
l
l
The rule used is always the
first
(from top to
bottom) applicable one.
Note: XÕs must match