next
|
previous
|
forward
|
backward
|
up
|
top
|
index
|
toc
|
Macaulay2 web site
Macaulay2Doc
>
The Macaulay2 language
>
lists and sequences
>
positions(VisibleList,Function)
positions(VisibleList,Function) -- which elements of a list satisfy a condition
Synopsis
Usage:
positions(v,f)
Function:
positions
Inputs:
v
,
a
visible list
f
,
a
function
, which, when applied to an element of
v
, yields
true
or
false
Outputs:
a
list
, the list of integers
k
, in ascending order, such that
f v#k
evaluates to
true
Description
i1 : positions(100..110,isPrime) o1 = {1, 3, 7, 9} o1 : List
See also
position
-- find first element of a list satisfying a condition
select
-- select from a list, hash table, or string