ContainsAll
ContainsAll[list1,list2]
yields True if list1 contains all of the elements of list2.
ContainsAll[list2]
is an operator form that yields True when the object to which it is applied contains all of the elements of list2.
Details and Options
- In ContainsAll[list1,list2], the listi must be lists of expressions, or representations of them, namely objects with heads like SparseArray, QuantityArray, Association or EntityClass.
- ContainsAll[list1,list2,SameTesttest] applies test to each pair of elements in the listi to determine whether they should be considered the same.
- ContainsAll[list2][list1] is equivalent to ContainsAll[list1,list2].
Examples
open allclose allBasic Examples (2)
Scope (4)
The English word facetious contains all five vowels:
Use ContainsAll in operator form:
Find the movies whose cast contains both Angelina Jolie and Brad Pitt:
ContainsAll works with associations:
Options (2)
SameTest (2)
By default, ContainsAll 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:
Applications (4)
Randomly find 10 English words containing all five vowels:
Find the shortest French word containing all five vowels:
Take the first character of each word of a text:
It does not contain words starting with all letters of the alphabet:
This larger text does contain words starting with all letters of the alphabet:
All of them do not appear as capital first letters in the text:
A pangrammatic lipogram is a text that uses all letters of the alphabet except one:
Properties & Relations (3)
ContainsAll[list1,list2] is equivalent to SubsetQ[list1,list2]:
Reversing the arguments of ContainsAll is equivalent to using ContainsOnly:
ContainsAll[list,{}] always returns True:
Text
Wolfram Research (2015), ContainsAll, Wolfram Language function, https://reference.wolfram.com/language/ref/ContainsAll.html.
CMS
Wolfram Language. 2015. "ContainsAll." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ContainsAll.html.
APA
Wolfram Language. (2015). ContainsAll. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ContainsAll.html