next | previous | forward | backward | up | top | index | toc | home
Macaulay2 > The Macaulay2 language > lists and sequences > VisibleList _ List

VisibleList _ List -- get some entries of a list

Synopsis

Description

The entries of w are numbered starting with 0. If i is negative, then the i-th entry counting from the end is provided. If i is out of range, an error is signaled.

i1 : w = {a,b,c,d,e,f,g,h}

o1 = {a, b, c, d, e, f, g, h}

o1 : List
i2 : w_{1,3,4}

o2 = {b, d, e}

o2 : List
i3 : w_{-1,-2,-3}

o3 = {h, g, f}

o3 : List

We can use this operation to compute composition of permutations represented as lists.

i4 : {4,2,3,1,0} _ {2,1,3,4,0}

o4 = {3, 2, 1, 0, 4}

o4 : List

Remark: any subscripts which are sequences will have their elements spliced into the rest of the list.

i5 : {a,b,c,d,e}_{2..4}

o5 = {c, d, e}

o5 : List

See also