¦ Depth


One-argument form  See also two-argument form Match

Depth is used to indicate the level of nesting. For a simple scalar, depth is 0. For other arrays, the depth of the array is 1+ the depth of the item of maximum depth in the array.

             ¦4                      (Depth of a scalar is 0)
       0
             ¦¼4                     (Depth of a vector is 1)
       1
             ¦2 2½¼6                 (Depth of a matrix is 1)
       1
             ¦'ABC' 1 2 3 (23 55)    (Maximum depth is 1+ depth of a vector)
       2
             'ABC' (2 4½('ABC' 2 3 'K'))
       ABC  ABC 2 3 K                (Maximum depth object within the array is
            ABC 2 3 K                 2 - a matrix)
             ¦'ABC' (2 4½('ABC' 2 3 'K'))
       3                             (Overall depth is thus 3)

See also ½ (shape) to enquire about the shape of an array.


Topic: APLX Help : Help on APL language : APL Primitives : ¦ Depth
[ Previous | Next | Contents | Index ]