New elements may be added to the front or back of a list using array assignment syntax equivalent to that used for the ORDMAP collection, except instead of string keys, you must use one of the special dot-variable pseudo keys:
$m(.PUSHFRONT) = X ! add new element to front; assign value X
$m(.PUSHBACK) = X ! add new element at back; assign value x
You may also insert an element into the middle of the list using the special dot-function .BEFORE($$i). In the following example, we scan the list until locating an element whose value is "something", and then insert a new element before it:
foreach $$i in $m()
if $$i = "something" then
$m(.BEFORE($$i)) = x ! insert new element before $$i position
exit
endif
next $$i
Modifying existing elements uses the same syntax as adding or inserting new elements, except with a different set of Dot Variables and Dot Functions:
$m(.FRONT) = y ! change value of first element to y
$m(.BACK) = y ! change value of last element to y
To update the value of an element by iterator, you must use the special dot function .REF($$i) to return to updateable reference to the iterator (since $$i by itself is a read-only copy of the value of the element).
foreach $$i in $m()
$m(.REF($$i)) = $$i + "y" ! update value of each element
next $$i