Thank you for the suggestions, but my intent may have ben unclear, it was:

Insert the first row of b as third column of first matrix of a
Insert the second row of b as third column of the second matrix of a

My simplification produced an index error, whereas the proposed form leads
to un intended results.

*The proposed forms:*

c ($@] $ [ b} ,@]) a

 2  7 12 17 22
27  6  7  8  9
10 11 12 13 14

15 16 17 18 19
20 21 22 23 24
25 26 27 28 29

 More readable second form:

 ($a) $ b c} ,a

 0  1  2  3  4
 5  6  7  8  9
10 11 12 13 14

15 16 17 18 19
20 21 22 23 24
25 26 27 28 29

*Intended results*:
    b(2&{"1@])}a

 0  1 0  3  4
 5  6 1  8  9
10 11 2 13 14

15 16 3 18 19
20 21 4 23 24
25 26 5 28 29

I can get what I need, but sometimes making the code more readable can lead
to unintended results.  It seems that finding out what went wrong may not
always worth the effort.

 In any event, I will read the definitions again, and your references more
carefully.

Thanks again.

Sent from my iPad

On 2012-05-18, at 22:02, Raul Miller <rauldmil...@gmail.com> wrote:

First, I think this is the expression you are looking for:

  c ($@] $ [ b} ,@]) a

Or, if you prefer:

   ($a) $ c b} ,a

My guess as to the reason for this is the examples on the two pages
that define item amend.

http://www.jsoftware.com/help/dictionary/d530n.htm
http://www.jsoftware.com/help/dictionary/d530v.htm

And my guess for the cause of the difference is editing drift --
probably one was updated to a new concept where the other was not.

I hope this helps,

-- 
Raul

On Fri, May 18, 2012 at 7:30 PM, Robert Cyr <robert....@gmail.com> wrote:

Inserting a 2 column array in a specified  column of a rank 3 array.


*Given*:


  a=.i.2 3 5

  b=.i.2 3

  ]c=.2{"1 a

 2  7 12

17 22 27


*This one is fine:*


  b(2&{"1@])}a

 0  1 0  3  4

 5  6 1  8  9

10 11 2 13 14


15 16 3 18 19

20 21 4 23 24

25 26 5 28 29


*But not this quite similar one*:

  b c }a

|index error

|   b     c}a


*Why?*



Sent from my iPad

----------------------------------------------------------------------

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

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

Reply via email to