
array - definition of an array

Calling sequence:

array(range ... [ , [ integer_1 ...] ]   )
array(range ... [ , [ integer_1 ...] ]   , equation ...)
array(range ... [ , [ integer_1 ...] ]   , list )
equation  --->  (integer_2 ...)  = expr

Parameter:
range       --  range of non-negative integers
integer_1   --  positive integer
integer_2   --  non-negative integer
expr        --  expression
list        -   list

Summary:

array is used to define an array.  The parameters consist of an number of
non-negative integer ranges that correspond to the dimension of the array.
The size of the array is defined by the ranges. Optionally a listcan be given at
the end that contains a positive integer for each dimension of the array. This
list defines the size of the subarraysinto which the whole array is divided.

The other parameters are also optional and consist either of any number
of equations that describe the individual initial entries of the array or a

list of lists that contain the entries of the array line-by-line.  If equations
are used for initializing the left side of each equation must give the index
of the corresponding array entry and the right side specifies the value of
the relevant entry. The initialization with lists needs complete details of all

array elements.  In the case of high dimensional arrays these lists must be
correspondingly embedded so that the innermost lists contain those elements
whose indicies differ only in the final dimension. array is a kernel function.

>>  array(1..6, 1..4, [3, 2]):

>>  array(1..8, 1..8, [2, 2], (1,1) = 11, (8,8) = 88):

>>  A := array(1..4, 1..3, (1,2) = 12): A[1,2];

      12

>>  A := array(1..2, 1..3, [[1, 2, 3], [4, 5, 6]]): A;

      array(1..2, 1..3, (1,1) = 1, (1,2) = 2,

      (1,3) = 3, (2,1) = 4, (2,2) = 5, (2,3) = 6)

See also:  table

