Shape

From APL Wiki
Revision as of 20:38, 26 September 2019 by Miraheze>Adám Brudzewsky
Jump to navigation Jump to search

The shape of an array is a vector of lengths of the dimensions of the array. The shape function 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

Template:APL programming language