I had a sneak peek at APL2 on the mainframe a number of years ago and remember being shown solutions to the problem of adding a vector to a matrix.
Given a←4 4 ⍴ ⍳16
and ⎕io←1
The old way of adding a vector to the rows was something like
a+(⍴a)⍴10 20 30 40
resulting in
11 22 33 44
15 26 37 48
19 30 41 52
23 34 45 56
and adding a vector to columns of a matrix was
a+(4 1⍴10 20 30 40)[;1 1 1 1]
or, if you prefer,
a+4/4 1⍴10 20 30 40
resulting in
11 12 13 14
25 26 27 28
39 40 41 42
53 54 55 56
Luckily, I was able to call up the guy who showed me APL2 that day (he's retired but still answers his phone) and ask about this second solution, who remembered right away what I was talking about.
The new APL2 way was much more concise, succinct, and consistent, those examples would be solved by a+[2] 10 20 30 40
and a+[1] 10 20 30 40
. Cool. And it worked in Dyalog.
Fast forward a decade or more and I see there is this new thing called The Rank Operator. The first example can be solved by a(+⍤1) 10 20 30 40
(I am still trying to come to grips on the usage of parentheses, I think I actually regenerated some brain cells once I thought I understood a bit of this)
Be that as it may, there is no straightforward (at least to me) analogue to the second example a+[1] 10 20 30 40
using the rank operator. I can't say I understand it at all, but it seems to me that the rank operator "re-casts" its left argument by collapsing its dimensions while leaving the contents intact. Too many years of C++ and Java have influenced my way of thinking about things.
Is there a simple solution to a+[1] 10 20 30 40
using the rank operator? The only think I found so far is ⍉(⍉a)(+⍤1) 10 20 30 40
which misses the point and defeats the whole purpose.
Why would the rank operator be preferable to the axis notation? Which is "better"? (a loaded term, to be sure) At first glance, the axis notation was very easy for me, a guy with a shoe size IQ, to grasp. I couldn't say the same for the rank operator.