On Thu, Sep 19, 2013 at 12:02 PM, Pascal Jasmin <[email protected]> wrote:
>    4 5 $ (+:@(3&{)"1 sel} ,) i. 4 5
>  0  1  2  6  4
>  5  6  7 16  9
> 10 11 12 26 14
> 15 16 17 36 19
>
> is there a gerund amend version that avoids the temp assignments? or other 
> code to get the same result?

In addition to the other proposals, I think this does what you want:

   3 +:@{`[`]}"1 i. 4 5
 0  1  2  6  4
 5  6  7 16  9
10 11 12 26 14
15 16 17 36 19

Note that it can be a little confusing, working through the errors you
get when experimenting with gerund amend. There's several verbs
involved, and how do you determine which one is causing the problem?

But you can expand out the definition and inspect what happens that
way. For example, this was an experiment I almost used:

   3 (4 :'(x{y) (x[y)} x]y'"1) i. 4 5

(But I didn't actually perform that experiment because when I noticed
that my broken code had an irrelevant ~ in it: 3 +:@{`[`]}"1~ i. 4 5)

I hope this helps,

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

Reply via email to