On Fri, Mar 03, 2017 at 02:57:00PM -0700, enz...@gmx.com wrote: > cause 1 is 1 element and 1 2 3 is 3 elements so ⍴ 1 2 3 is 3 > and ⍴ 1 should have been 1
But 1-element arrays come in many different shapes and ⍴ returns the shape rather than number of elements. To get the later you would use ×/⍴ and ×/⍴1 is indeed 1 but so is ×/⍴(1 1 1 1⍴1). As for the syntax, it's not exactly accurate and doesn't apply to character vectors but I find it convenient to assume that bare number is always a scalar. Consider that in APL2 you can create vectors by juxtaposing values: A←1 B←2 1 2 ≡ A B 1 So we can pretend there is no special syntax for numeric vector literals at all. It doesn't translate well to character vectors but I consider 'aa' to be a syntactic sugar for 'a' 'a'. I don't know the original reasoning behind it but I think it's the most natural to have bare number literal stand for the most basic kind of value that exists in a language. As long as we want to have 0-rank arrays (and we do!), forcing one to write something like ↑1 to get a scalar would be weird and I prefer having to write ,1 for vector instead. -k