Select
Details
- The object list can have any head, not necessarily List.
- When used on an Association, Select picks out elements according to their values.
- Select can be used on SparseArray objects. »
- Select[crit][list] is equivalent to Select[list,crit].
- Parallelize[Select[list,crit]] computes Select[list,crit] in parallel on all subkernels. »
Examples
open allclose allBasic Examples (5)
Select elements that are even:
Use a pure function to test each element:
Return only the first expression selected:
Use the operator form of Select:
Select operates on values in an Association:
Scope (5)
Select picks out elements for which applying the criterion explicitly yields True:
Applying the criterion to the symbolic object x does not explicitly yield True:
Find up to 2 pairs containing x:
Fewer than the requested elements may be returned:
Use an operator form as selection criterion:
Use Select in operator form:
Generalizations & Extensions (2)
Select works with any head, not just List:
Select works with SparseArray objects:
Applications (7)
Select numbers up to 100 that equal 1 modulo both 3 and 5:
Select 4-tuples that read the same in reverse:
Find the first four 3×3 matrices of 0s and 1s that have determinant 1:
Select eigenvalues that lie within the unit circle:
Find built-in Wolfram Language objects whose names are less than 3 characters long:
Select numeric quantities from a product:
Find an approximation to by finding the proportion of points that lie within a disk:
Properties & Relations (3)
Select is similar to Cases except that it uses a function instead of a pattern:
Select the lists that have sum of elements less than 10:
Use Cases to get the same result:
Select elements that are even:
Separate odd and even elements:
Construct an association that explicitly contains as keys the results of the criterion function:
Compute Select in parallel:
Text
Wolfram Research (1988), Select, Wolfram Language function, https://reference.wolfram.com/language/ref/Select.html (updated 2014).
CMS
Wolfram Language. 1988. "Select." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/Select.html.
APA
Wolfram Language. (1988). Select. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Select.html