Supported Operations for Lists
You can perform the following kinds of operations on lists.
Insert
Insert elements expr1 , ..., exprn between the (i–1)-th and i-th element of the list.
lst = [lst(0:i-1), expr1,..., exprn, lst(i:*)]
Append
Append elements expr1, ..., exprn after the last element in the list.
lst = [lst, expr1,..., exprn]
Prepend
Prepend elements expr1, ..., exprn before the first element in the list.
lst = [expr1,...,exprn, lst]
Replace
Replace elements between element start and element end with the elements expr1, ..., exprn .
lst = [lst(0:start), expr1,...exprn, lst(end:*)]
Delete
Delete elements between element start and element end.
lst = [lst(0:start), lst(end:*)]
Create Sublists
The method for creating sublists is the same as creating subarrays. For example:
; Create a sublist from a specific range of elements.
sublist = lst(from:to)
; Create a sublist from a specified element to the last element.
toend   = lst(from:*)
; Create a sublist from the first element to a specified element.
startto = lst(0:to)
; Create a sublist containing specified elements only.
sublist = lst([0,2,5])
Enumeration
Lists can be referenced in loops just like other kinds of arrays:
FOR i = 0, N_ELEMENTS(lst) - 1 do BEGIN
; do something with the variable
lst(i) = lst(i) + 1 
ENDFOR