Macaulay2
»
Documentation
Packages
»
Macaulay2Doc
::
select(ZZ,BasicList,Function)
next
|
previous
|
forward
|
backward
| up |
index
|
toc
select(ZZ,BasicList,Function) -- select a limited number of elements from a list
Synopsis
Function:
select
Usage:
select(n,v,f)
Inputs:
n
v
f
, returning either
true
or
false
Outputs:
a list containing at most
n
elements of the list
v
that yield
true
when the function
f
is applied.
Description
The order of the elements in the result will be the same as in the original list
v
.
i1 : select(4,0..10,even) o1 = (0, 2, 4, 6) o1 : Sequence
See also
select(BasicList,Function)
-- select elements from a list
partition
-- partition a set or list by values of a function
Ways to use this method:
select(ZZ,BasicList,Function)
-- select a limited number of elements from a list