Shape: Difference between revisions
Content added Content deleted
No edit summary |
No edit summary |
||
Line 7: | Line 7: | ||
^(0 1 2;"abcd") |
^(0 1 2;"abcd") |
||
,2 |
,2 |
||
For rectangular arrays, it can be implemented as <ref>https://chat.stackexchange.com/transcript/90748?m=58570758#58570758</ref>: |
|||
d:-1_#:'*:\ |
|||
d[+4 3#1] |
|||
3 4 |
Revision as of 22:17, 27 July 2021
Shape
^x
Shape is a primitive that returns the list of lengths along all axes of a uniform array. For ragged arrays it returns only as many items as there are levels of uniformity.
Shape is available in k3 and kona, and not available in k4, oK, ngn/k, and k9.
^(0 1 2;"ab",`c) 2 3 ^(0 1 2;"abcd") ,2
For rectangular arrays, it can be implemented as [1]:
d:-1_#:'*:\ d[+4 3#1] 3 4