next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
Macaulay2Doc :: take

take -- Take some elements from a list or sequence.

Synopsis

Description

i1 : take({a,b,c,d,e,f,g}, 3)

o1 = {a, b, c}

o1 : List
i2 : take({a,b,c,d,e,f,g}, -3)

o2 = {e, f, g}

o2 : List
i3 : take({a,b,c,d,e,f,g}, {1,3})

o3 = {b, c, d}

o3 : List
i4 : take({a,b,c,d,e,f,g}, {2,2})

o4 = {c}

o4 : List

The pair {j,k} must be given with both entries non-negative, and j≤k. Otherwise an empty list is returned.

i5 : take({a,b,c,d,e,f,g}, {3,1})

o5 = {}

o5 : List
i6 : take({a,b,c,d,e,f,g}, {4,-1})

o6 = {}

o6 : List

See also

Ways to use take :