=≤<>≥≡≢#

Comparisons =≤<>≥≡≢#

= is comparison (not assignment!) and penetrates all structures, giving a single Boolean (0 or 1) per leaf element. is the negation of that.

≤<>≥ work as you’d expect, again penetrating all structure.

A≡B is match. It compares the entire arrays A and B in all respects, even the invisible prototype:

''   ⍝ does the empty char vector match the empty numeric vector?
0

A≢B is not match, the negation of A≡B.

Depth, tally ≡≢#

Monadic ≡B gives the depth of B, which is the amount of nesting. A simple scalar is 0, a vector is 1, a vector of vectors is 2, etc. If the amount of nesting is uneven throughout the array, the result will be negative, and indicate the maximum depth.

≢B is the tally of B, i.e. how many major cells B has. For a scalar, that’s 1. For a vector, it is the number of elements, for a matrix it is the number of rows, for a 3D array it is the number of layers, and so on.

(1 2 (3 4 5 (6 7 8)))  ⍝ unevenly nested vector
1                      ⍝ scalars tally to 1
3 2⍴⍳6                 ⍝ matrix tally is the number of rows
¯3
1
3