Type:
putList: list x object x integer -> list
Call syntax:
putList(aList,
newObject,
index)
aList
@index
:= newObject
Description:
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).
Error conditions:
Specifying an incorrect position (not within
1 ... length(aList)) causes an error condition.
Example:
> putList(LIST(1,2,3,4), 0, 3)
Result= LIST(1,2,0,4)
> l := LIST(1,2,3,4)
> l@3 := 0
> l
Result= LIST(1,2,0,4)
> putList(LIST(1,2,3,4), 0, 5)
Error in command-line:
Wrong index
(occured while executing function "putList")
See also: LIST, LISTINIT, consList, getList, inList, Operator "@".