Previous section: The Instantiable Collection Classes

Dylan reference manual -- Operations on Arrays

## Operations on Arrays

```dimensions   array   =>  sequence	[Function]
```
Returns the dimensions of array, as a sequence of integers. The consequences are undefined if the resulting sequence is modified.

This function forms the basis for all the other array operations. Each concrete subclass of <array> must either provide or inherit an implementation of this function.

```? dimensions (make (<array>, dimensions: #(4, 4)))
#(4, 4)
```
```size array => size 	[G. F. Method]
```
The method for <array> is equivalent to reduce (\*, 1, dimensions (array)).

There is a standard library for arrays, containing the following generic functions and methods, as defined below: rank, row-major-index, aref, aref-setter, and dimension.

```rank array => rank	[Generic Function]
```
Returns the number of dimensions (the rank) of array.
```rank array => rank	[G. F. Method]
```
The method for <array> computes rank by calling size on the dimensions of array.
```row-major-index array #rest subscripts => index 	[Generic Function]
```
Computes the position according to the row-major ordering of array for the element that is specified by subscripts, and returns the offset of the element in the indicated position from the start of the array. An error is signaled if the number of subscripts is not equal to the rank of the array. An error is signaled if any of the subscripts are out of bounds for array.
```row-major-index array #rest subscripts => index 	[G. F. Method]
```
The method for <array> computes the index using the result of calling dimensions on the array.
```aref array #rest indices => element 	[Generic Function]
```
Returns the element of array indicated by indices. An error is signaled if the number of indices is not equal to the rank of the array. An error is signaled if any of the indices are out of bounds for array.
```aref array #rest indices => element 	[G. F. Method]
```
The method for <array> calls element on the array, using the result of applying row-major-index to the arrayand indices as the key.
```aref-setter new-value   array  #rest indices => new-value  	[Generic Function]
```
Sets the element of array indicated by indices to the new value and returns the new value. An error is signaled if the number of indices is not equal to the rank of the array. An error is signaled if any of the indices are out of bounds for array. An error is signaled if the arrayis limited to hold objects of a particular type and the new value is not an instance of that type.
```aref-setter new-value   array  #rest indices => new-value 	[G. F. Method]
```
The method for <array> calls element-setter on the array and new value, using the result of applying row-major-index to the array and indices as the key.
```dimension array axis => dimension  	[Generic Function]
```
Returns the axis dimension of array. axis must be a non-negative integer less than the rank of array. An error is signaled if axis is out of bounds for array.
```dimension array axis => dimension  	[G. F. Method]
```
The method for <array> calls element on the result of calling dimensions on the array, using the axis number as the key.

Next section: Operations on Deques