Select
Select[list, crit] picks out all elements
of list for which crit[
] is True.
Select[list, crit, n] picks out the first n elements for which crit[
] is True.
Example: Select[
1,4,2,7,6
, EvenQ]
.
The object list can have any head, not necessarily List.
See The Mathematica Book on the web: Section 2.2.7.
See also: Cases, Take, Drop.
Further Examples