The
three-item form is used if the associated function is
ambivalent (applied to the P-cells of ⍵ if monadic,
applied to corresponding Q-cells of ⍺ and R-cells of ⍵
if dyadic). I don't believe it is possible to define
ambivalent functions in ISO APL however, so it is kind
of redundant. It is probably left over from Sharp APL.
As to the negative rank, I believe that it
is an obvious flaw in the standard. Being able to
apply a function to the items of the
argument is incredibly useful. Of course this is
achievable like so:
{⍺ (f ⍤ (¯1+≢⍴⍺⍵)) ⍵} ⍝
without ⍺ for the monadic form
Now that I've checked, I'm pretty sure
that GNU APL does support rank (negative or not), but not with all primitives. Try it
out with ⊖ or +⌿ on a rank-3 or above array, and then
with ]BOXING and ⊂ on the same array… looks like a bug
to me.
The rank operator isn't easy to grasp, and
it's surely harder to implement.
Good luck,
Louis
Incidentally, it works like this
in Dyalog and NARS2000 too, though
the Dyalog documentation doesn't mention the
3-item form.
Jay.
On 27 April 2016 at 09:02, Jay Foad <
address@hidden>
wrote:
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