On Fri, Nov 16, 2012 at 5:59 PM, Peter B. Kessler
<peter.b.kess...@oracle.com> wrote:
> What I can't give you is a feeling for how Raul Miller came up with this
> particular way of producing that result.

I am not used to seeing my name repeated so many times, I am not sure
how to deal with that.

That said, I do happen to know how Raul Miller came up with this... so
let's see if I can describe that:

First, I've used the "modify along one dimension and then transpose
with power to modify all dimensions" strategy in other contexts.
Also, I am comfortable with #$noun or #@$ as the expression for rank
of a noun.

So then I was thinking about how transpose was a no-op for a
one-dimensional array, and 2 was the number of dimensions here, so I
replaced ^:2 with ^:(#@$) and tried the result on some various arrays.
After fixing the missing comma, it worked fine on low dimensioned
arrays but a $ on a 3d array looked wrong.

So, then I remembered that the default definition for |: involved
reversing the dimensions or an array, and I wanted to rotate them.  So
I replaced [: |: with 0 |: and that was the result you saw (the
dimension(s) listed in the left argument become the final dimension(s)
of the result).

So that was all there was to it -- most of the work had already been done.

FYI,

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to