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

switch -- copy a list, switching two elements

Synopsis

Description

A negative value of i or j is taken relative to the end of the list.

i1 : L = 0..10;
i2 : switch(3, 9, L)

o2 = (0, 1, 2, 9, 4, 5, 6, 7, 8, 3, 10)

o2 : Sequence
i3 : switch(0, -1, L)

o3 = (10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0)

o3 : Sequence
i4 : switch(-1, -2, L)

o4 = (0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 9)

o4 : Sequence

See also

Ways to use switch :