List Operators

Almost all operators accept lists as operands. For example, if you supply lists as operands to the Add operator, it adds all corresponding elements in the lists. However, several operators are designed exclusively to manipulate.

List Operators

Operator Description
List Literal [x,y,...] Create a list simply by enclosing a list of expressions in square brackets. For example, [1,2,3,4] creates a list of the four numbers 1 to 4.
Range x..y Provides a way to create a list of consecutive integers. For example, the expression 1..4 is the same as [1,2,3,4]. Similarly, 4..1 is the same as [4,3,2,1].
List Concatenate x!!y Combines two lists into a single, large list. For example, the expression [1,2]!![3,4] is the same as [1,2,3,4]. Note the expression x!!y is not the same as [x,y]. The latter expression adds a new dimension to the lists x and y while the first expression does not.
List Element x[y] Access particular elements in a list you have created. For example, x[0] is the first element in the list named x. Similarly, x[4] is the fifth element. Note the index number y is zero-based. If you supply a list of elements for the operand y, then the result is a list of elements. For example, x[0..4] returns a list containing the first five elements in x. If x is a two dimensional array such as [[1,2,3],[4,5,6]], then you can access particular elements using an expression such as x[0][2]. This expression represents the third element in the first list in x, (3).
Subscript x#y Works just like the List Element operator except the element index is one-based. For example, x#1 is the first element in x and x#5 is the fifth. Just as with the List Element operator, the Subscript operator accepts a list of index numbers in y (e.g., x#1..5) and can be used to access elements in multi-dimensional arrays (e.g., x#1#3).
delete delete x[y] Delete specific elements in a list. For example: