"Manipulating Elements of Lists"
shows how you can pick out elements of lists based on their positions
. Often, however, you will need to select elements based not on where
they are, but rather on what
selects elements of list
using the function f
as a criterion. Select
to each element of list
in turn, and keeps only those for which the result is True
You can use Select
to pick out pieces of any expression, not just elements of a list.
"Putting Constraints on Patterns"
discusses some "predicates" that are often used as criteria in Select