[ ECLiPSe Lists Library predicate.|Group Index| Full Index]

nonmember(+Element, +List)

Succeeds if Element is not an element of the list List.

+Element
Prolog term.
+List
List.

Description

Used to check that Element is not a member of the list List.

The definition of this Prolog library predicate is:

nonmember(Arg,[Arg|_]) :-
        !,
        fail.
nonmember(Arg,[_|Tail]) :-
        !,
        nonmember(Arg,Tail).
nonmember(_,[]).
The following should be noted:

1. This predicate does not perform any type testing functions.

2. This predicate is not protected by ECLiPSe and may be redefined without generating a warning message.

Fail Conditions

Fails if Element is an element of the list List.

Resatisfiable

No.

Exceptions

Examples


Success:
  nonmember(q,[1,2,3,4,5,6,7]).

Fail:
  nonmember(1,[1,2,3]).
  nonmember(q,[1,2,2,X]). % X and q are unifiable


See Also

member / 2, memberchk / 2