⍴ — Shape / Reshape
Function. Keys: Alt-r. Hanzi: 形. Ranks: ∞ monadic, 1 ∞ dyadic
⍴Y gives axis lengths.
⍴2 3⍴0 ⍝ [2 3]ₓThe shape is keyed by the axis names. An unnamed axis gives an unkeyed entry. See named axes.
M←["city":2 "month":3]⍴⍳6ₓ
⍴M ⍝ ["city":2 "month":3]ₓ
"month"⌷⍴M ⍝ 3ₓS⍴Y reshapes, cycling or truncating the ravel of Y. Dimensions are nonnegative whole numbers. Empty Y supplies fill, which ⍠ can choose.
2 3⍴1 2 ⍝ [1 2 1⋄2 1 2]
3⍴"" ⍝ " "An empty shape makes a rank-zero array.
⍬⍴1 2 ⍝ ⊂1A keyed S names the axes of the result. An unkeyed S gives no names. When S matches the shape of Y, the result keeps the position keys of Y.
⍴["city":2 3]⍴⍳6ₓ ⍝ ["city":2 3]ₓInverse
S⍴⁻Y ravels Y, which must have shape S.
2 3⍴⁻2 3⍴⍳6ₓ ⍝ [0 1 2 3 4 5]ₓ