Closed ngn closed 4 years ago
In k3, you get (+1)~1
and (+1 2)~1 2
.
In k5, and the last version of k6 I ever got, you get a rank error for both of those cases.
In k7, Arthur appeared not to bother implementing +:
for atoms at all.
The behavior of k5/k6/k7 suggests to me that Arthur considers this irrelevant. I consider myself more than free to improve upon edge-cases which throw errors, and you make a reasonably convincing case for this generalization. Done!
Given
+1 1
is,1 1
, shouldn't+1
be,,1
instead of1
?I know k arrays can be ragged, but that's irrelevant to my argument, so let's ignore them for a moment and talk about "shapes", "ranks", and "dimensions".
In APL transpose (
⍉
) reverses the shape, so it makes sense for the transpose of a scalar (which is of course empty-shaped) to be itself a scalar.In k flip (
+
) is supposed to swap the 2 leading "dimensions", so we run into a problem when there are fewer than 2.Kona (and k3?) resolves this by reversing only the leading min(2,rank(x)) "dimensions":
oK (and k5/k6?) appears to be treating the "shape" as if it's followed by implicit 1s (which is very reasonable):
+1 1
evaluates to,1 1
, but there's a discontinuity for+1
: