Thanks, that's interesting. However, I'm still a big confused about the 3-value case. When is P, Q and R all used?
Secondly, do you agree that that negative ranks would be useful? Regards, Elias On 27 April 2016 at 16:02, Jay Foad <jay.f...@gmail.com> wrote: > You're reading section 9.3.4 "Rank operator deriving monadic > function". You also need to look at 9.3.5 "Rank operator deriving > dyadic function". > > Given g ← f⍤P Q R: > P is the monadic rank > Q is the left rank > R is the right rank > > So: > g Y applies g to the P-cells of Y > X g Y applies g to the Q-cells of X and the R-cells of Y > > The ⌽3⍴⌽y1 stuff is just a too-cute way of saying that you can specify > fewer than 3 values in the right operand, and: > R is shorthand for R R R > Q R is shorthand for R Q R > > Jay. > > On 27 April 2016 at 08:28, Elias Mårtenson <loke...@gmail.com> wrote: > > About the ISO specification of ⍤ > > > > In writing the above message, I was reading the ISO specification for the > > rank operator, and I find it incredibly confusing. I have quoted the > > description below, and based on my reading of this text, the rank > parameter > > is not just a single value, but can be up to three values. However, no > > matter how I read it, I still can't see how any but the the very first > value > > is actually every used. > > > > Also, the case where LENGTH ERROR is supposed to be raised does not > happen > > in GNU APL. > > > > It seems as the specification for the rank operator is just broken on > > several levels in the spec. That seems to me to be reason enough to not > pay > > attention to the spec in this case and just adapt the way Dyalog does it. > > > > Here's the spec for the rank operator from the ISO spec: > > > > Informal Description: > > The result of f⍤y is a function which, when applied to B, returns Z, the > > result of applying the function f to the rank-y cells of B. > > > > Evaluation Sequence: > > If y is a scalar, set y1 to ,y. Otherwise set y1 to y. > > If y1 is not a vector, signal domain-error. > > If y1 has more than three elements, signal length-error. > > If any element of y1 is not a near-integer, signal domain-error. > > Set y2 to ⌽3⍴⌽y1. > > Set y3 to the first-item in y2. > > Set y4 to the integer-nearest-to y3. > > If y4 exceeds the rank of B, set y5 to the rank of B, otherwise set y5 to > > y4. > > If y5 is negative, set y6 to 0⌈y5 plus the rank of B, otherwise set y6 to > > y5. > > Apply f to the rank-y6 cells of B. > > Conform the individual result cells. Let their common shape after > conforming > > be q, and let p be the frame of B with respect to f, that is, (rank of B) > > minus y6, and > > return the overall result with shape p,q. >