Data Structure Manipulations - 2
The dimensions of a 3D data array in APL can be thought of as like an Excel workbook, with Sheets, Rows, Columns.
In APL, the dimensions (or axes) are called 1st, 2nd, 3rd etc. and are referred to as [ 1 ], [ 2 ], [ 3 ] etc. in APL expressions. Although there can be up to about 130 dimensions in APL, 3 dimensions will probably cover most requirements.
For 2D arrays, the first axis is in the direction of increasing number of rows (down), and the second axis is in the direction of increasing number of columns (to the right). For a 3D data object the three axes are into the page for increasing number of planes, and then down for increasing number of rows, and right for increasing number of columns.
Regardless of the total number of dimensions, the last (or right most) is always the direction of increasing number of columns.
In APL many of the data structure operations, the axis is specified which will be changed by the transformation. For example if two 3 x 3 matrices are to be joined (catenated), then the joining can be achieved with the following: " M1 , [ 1 ] M2" which says " M2 is catenated to M1 along the first axis. The 1st axis is the direction of increasing the number of rows, so M2 is catenated below M1, the number of rows is increased. " M1 , [ 2 ] M2 " says "M2 is catenated to M1 along the 2nd axis, resulting in an increase in the 2nd dimension (more columns).