| Applying science to business management |
  
replist
Format: replist( list, offset, len, rep )
Arguments: [any] list Input list
[int] offset Starting location of the sublist
(int) len Length of the sublist to be replaced
[any] rep Replacement list
Returns: [any] list with len elements
beginning at offset replaced by rep
Description: Replist can be used to remove, insert, or
replace elements in a list.
The offset argument can be a list of integers that
specify a position deep within a hierarchical list. The first
integer in the list is the offset on the first level, the second
element is the offset on the second level, and so on. For
example, the element at offset 2 in the list
[[1,2],[3,4,5],[6,7]] is the sublist [3,4,5]. The element at
offset [2,3] is the number 5.
Examples: replist([3,4,5,6,7],1,1,"X")
= [3,X,5,6,7]
replist([3,4,5,6,7],1,0,"X")
= [3,X,4,5,6,7]
replist([[1,2],[3,4]],[1,0],1,"X")
= [[1,2],[X,4]]
replist([1,2,3],1,0,["X","Y"])
= [1,X,Y,2,3]
replist([1,2,3],1,0,[["X","Y"]])
= [1,[X,Y],2,3]
See Also: Assign, List Element, index, sublist
|