Array shape

The shape (⍴) of such an array is the list of all the lengths of the lists used to form it. The length of this list is called its rank.

      ⍴ (⍳2) ∘., (⍳3) ∘., (⍳4)
2 3 4

The shape of an outer product of two arrays is found by combining the shapes of the two arrays.

      ⍴ (⍳2 3) ∘., (⍳4 5)
2 3 4 5

The shape function transforms the monoid of arrays under ∘., to the monoid of lists of natural numbers under , . We know ∘., is associative because , is!