Shape
⍴

Shape (⍴
) is a monadic function which returns the shape of its argument array, namely a vector of lengths of the array along each axis. The dyadic function using the same symbol is Reshape which produces an array of the shape specified by its left argument.
An array's shape may be any vector of nonnegative integers with length less than or equal to the maximum rank. The length of an array's shape is the array's rank, and the product of the shape is its bound. If the shape is empty then the array is a scalar.
An array's shape, along with the index origin, determine the possible values which can be used as an index into the array. A complete index is a vector of integers with the same length as the shape. When the index origin is subtracted from the index each element must be at least 0 and less than the corresponding element of the shape. In languages with negative indexing it may be greater than or equal to the negative of the shape rather than 0.
Examples
(⍬≡⍴)¨1 'A' ⍝ The shape of a scalar is the empty numeric vector ⍬
1 1
⍴'ABCDE' ⍝ The shape of a vector is a length1 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
External links
Lessons
Documentation
 Dyalog
 NARS2000
 APLX
 J Dictionary, J NuVoc (as
$
"Shape Of")
APL features [edit]  

Syntax  Array ∙ Function ∙ Operator ∙ Assignment 
Builtins  Primitive function ∙ Primitive operator ∙ Quad name 
Array model  Shape ∙ Rank ∙ Depth ∙ Bound ∙ Index ∙ Axis ∙ Ravel ∙ Ravel order ∙ Element ∙ Scalar ∙ Vector ∙ Matrix ∙ Simple scalar ∙ Simple array ∙ Nested array ∙ Box ∙ Cell ∙ Major cell ∙ Subarray ∙ Empty array ∙ Prototype 
User definition  Tradfn ∙ Dfn ∙ Tacit 
Concepts and paradigms  Leading axis theory ∙ Scalar extension ∙ Conformability ∙ Scalar function ∙ Glyph ∙ Identity element 
Errors  LIMIT ERROR ∙ RANK ERROR 
APL builtins [edit]  

Primitive functions  
Scalar  
Monadic  Conjugate ∙ Not ∙ Roll ∙ Type  
Dyadic  Plus ∙ Equal to (Xnor) ∙ Not Equal to (Xor)  
NonScalar  
Structural  Shape ∙ Reshape ∙ Depth ∙ Ravel ∙ Reverse  
Selection  Take ∙ Drop ∙ Unique  
Selector  
Computational  
Primitive operators  Each  
Quad names  
Constants  Index origin ∙ Migration level  
Functions  
Operators  
Other  Zilde ∙ High minus 