## Operations on Arrays

dimensionsarray=>sequence[Function]

Returns the dimensionsofarray, 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)

sizearray=>size[G. F. Method]

The method for<array>is equivalent toreduce (\*, 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, anddimension.

rankarray=>rank[Generic Function]

Returns the number of dimensions (the rank) ofarray.

rankarray=>rank[G. F. Method]

The method for<array>computesrankby callingsizeon thedimensionsofarray.

row-major-indexarray#restsubscripts=>index[Generic Function]

Computes the position according to the row-major ordering ofarrayfor the element that is specified bysubscripts, and returns the offset of the element in the indicated position from the start of thearray. 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-indexarray#restsubscripts=>index[G. F. Method]

The method for<array>computes theindexusing the result of callingdimensionson thearray.

arefarray#restindices=>element[Generic Function]

Returns the element ofarrayindicated byindices. An error is signaled if the number ofindicesis not equal to the rank of thearray. An error is signaled if any of theindicesare out of bounds forarray.

arefarray#restindices=>element[G. F. Method]

The method for<array>callselementon thearray, using the result of applyingrow-major-indexto thearrayandindicesas the key.

aref-setternew-value array#restindices=>new-value[Generic Function]

Sets the element ofarrayindicated byindicesto the new value and returns the new value. An error is signaled if the number ofindicesis not equal to the rank of thearray. An error is signaled if any of theindicesare out of bounds forarray. An error is signaled if thearrayis limited to hold objects of a particular type and the new value is not an instance of that type.

aref-setternew-value array#restindices=>new-value[G. F. Method]

The method for<array>callselement-setteron the array and new value, using the result of applyingrow-major-indexto thearrayand indices as the key.

dimensionarray axis=>dimension[Generic Function]

Returns theaxisdimension ofarray.axismust be a non-negative integer less than the rank ofarray. An error is signaled ifaxisis out of bounds forarray.

dimensionarray axis=>dimension[G. F. Method]

The method forNext section: Operations on Deques<array>callselementon the result of callingdimensionson thearray, using theaxisnumber as the key.