6.3.5 Selecting elements of a list
The
select
command selects elements of a list meeting the given conditions.
select
takes two arguments:
f
, a boolean function.
L
, a list.
select(
f
,
L
)
returns the sublist of
L
consisting of the elements
c
such that
f
(
c
) returns
true
.
Example
select
(
x
->(
x
>=2),[0,1,2,3,1,5])
⎡
⎣
2,3,5
⎤
⎦