putList: list x object x integer -> list
putList(aList, newObject, index)
aList @index := newObject
Returns a list which is obtained by replacing the element at position index in list aList with object newObject. Position counting starts with 1 for the first element. The original list aList is not modified by function putList (all parameters are call-by-value).
When using the @ -operator, aList has to be a variable of type list; here, aList is actually modified, which is more efficient then using the equivalent assignment aList := putList(aList,newObject,index).
Specifying an incorrect position (not within 1 ... length(aList)) causes an error condition.
> putList(LIST(1,2,3,4), 0, 3)
> l := LIST(1,2,3,4)
> l@3 := 0
> putList(LIST(1,2,3,4), 0, 5)
Error in command-line:
(occured while executing function "putList")
See also: LIST, LISTINIT, consList, getList, inList, Operator "@".