Shape

From APL Wiki
Revision as of 08:27, 26 September 2019 by Miraheze>RikedyP (Created page with "The shape of an array is a vector of lengths of the dimensions of the array. The shape funcion <code class="apl">⍴</code> returns the shape of its right argument array. <pre...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The shape of an array is a vector of lengths of the dimensions of the array. The shape funcion returns the shape of its right argument array.

      (⍬≡⍴)¨1 'A'                 ⍝ The shape of a scalar is the empty numeric vector ⍬
1 1
      ⍴'ABCDE'                    ⍝ The shape of a vector is a length-1 vector
5
      ⍴'ABC'∘.,1 2 3 4            ⍝ The shape of the matrix result of an outer product
3 4
      ⍴'ABC'∘.,1 2 3 4∘.×0J1 1J2  ⍝ Two consecutive outer products result in a cuboid
3 4 2