next up previous

4.1 Array Operations     continued...

Array Constructors
Array values may be explicitly constructed using the array constructor and, if the desired resultant array has dimension higher than one, the RESHAPE intrinsic function; an array constructor forms a one-dimensional array. An array constructor is simply a list of the element values of the result, separated by commas and enclosed in (/ /) delimiters. The above APL 4 example may be written as the Fortran 90 array constructor
        (/1,2,3,4/)

(though there is a more general way of specifying such an ``iota" sequence). Each element in this example is a simple scalar constant. In general, any element in an array constructor can be any scalar expression. If they are all constants, however, then such a constructor (possibly combined with the RESHAPE function - see below) represents an array constant and may appear in a PARAMETER declaration. Array constructors (combined with RESHAPE) are, therefore, the Fortran 90 means of representing array constants.

If each element had to be explicitly listed, the array constructor would not be very practical for specifying very large array values. Therefore two forms for array constructor list items are provided in addition to scalar expressions. These are implied-do constructs and array expressions. The first of these has the form

 (expression-list, index-variable = first-value, last-value[,increment])