Macaulay2 » Documentation
Packages » Macaulay2Doc :: replace(ZZ,Thing,BasicList)
next | previous | forward | backward | up | index | toc

replace(ZZ,Thing,BasicList) -- copy a list, replacing an element

Synopsis

Description

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

i1 : replace(4,   t, 0..10)

o1 = (0, 1, 2, 3, t, 5, 6, 7, 8, 9, 10)

o1 : Sequence
i2 : replace(0,   t, 0..10)

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

o2 : Sequence
i3 : replace(10,  t, 0..10)

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

o3 : Sequence
i4 : replace(-1,  t, 0..10)

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

o4 : Sequence
i5 : replace(-11, t, 0..10)

o5 = (t, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)

o5 : Sequence

Ways to use this method: