Second Alternate
(less desirable)
l
Use a
conditional guard
:
l
member(X, [ ]) => 0;
l
member(X, [F| R]) => (X == F) ? 1;
l
member(X, [F| R]) => member(X, R);
l
The condition is tested after any other matching
is applied.
l
If the condition fails, then subsequent rules are
tried.
conditional guard