ContainsNone

ContainsNone[e1,e2]

yields True if e1 contains none of the elements in e2.

ContainsNone[e2]

is an operator form that yields True when the object to which it is applied contains none of the elements of e2.

Examples

open allclose all

Basic Examples  (2)

The first list contains none of the elements of the second list:

The first list contains elements of the second list:

Scope  (5)

There are English words containing none of the five vowels:

Use ContainsNone in operator form:

Select music works:

Find the movies directed by Pedro Almodóvar whose cast includes none of several actors:

ContainsNone works with associations:

Options  (2)

SameTest  (2)

By default, ContainsNone considers elements to be the same if they are identical:

Changes of units are taken into account, as long as they represent the exact same quantity:

Numerical approximations are not considered as the same object:

Use Equal as the comparison function to have numerical tolerance:

String comparisons are case sensitive by default:

Convert to lower case before comparing:

Applications  (1)

Take the list of words in this text:

That list of words does not contain any of these:

However, that is not true if "rabbit" is added:

Properties & Relations  (5)

ContainsNone[list1,list2] is equivalent to testing for empty intersection of the lists:

ContainsNone[list1,list2] is equivalent to DisjointQ[list1,list2]:

ContainsNone is a symmetric function of its arguments. That is, ContainsNone[list1,list2]==ContainsNone[list2,list1]:

Negation of ContainsNone[list1,list2] is equivalent to ContainsAny[list1,list2]:

ContainsNone[list,{}] always returns True:

Introduced in 2015
 (10.2)