If at first you don't succeed ...  Insert after row j :

   m=: 10+i.5 3
   j=: 1

   ((1+j){.m), 7 8 9, (1+j)}.m
10 11 12
13 14 15
 7  8  9
16 17 18
19 20 21
22 23 24
   (<0,1+i.1+j) C. 7 8 9,m
10 11 12
13 14 15
 7  8  9
16 17 18
19 20 21
22 23 24
   (7 8 9,m) /: (1+j),i.#m
10 11 12
13 14 15
 7  8  9
16 17 18
19 20 21
22 23 24



----- Original Message -----
From: Roger Hui <[EMAIL PROTECTED]>
Date: Monday, April 28, 2008 22:52
Subject: Re: [Jprogramming] BegQ--row deletion/insertion
To: Programming forum <[email protected]>

> The last expression should be (<0,1+i.j) C. 7 8 9,m
> for inserting a row after row j :
> 
>    (<0,1+i.j) C. 7 8 9,m
> 10 11 12
>  7  8  9
> 13 14 15
> 16 17 18
> 19 20 21
> 22 23 24
> 
> 
> 
> ----- Original Message -----
> From: Roger Hui <[EMAIL PROTECTED]>
> Date: Monday, April 28, 2008 21:12
> Subject: Re: [Jprogramming] BegQ--row deletion/insertion
> To: Programming forum <[email protected]>
> 
> >    ] m=: 10+i.5 3
> > 10 11 12
> > 13 14 15
> > 16 17 18
> > 19 20 21
> > 22 23 24
> >    ] j=: ?. #m
> > 1
> >    NB. delete row j
> >    (j~:i.#m)#m
> > 10 11 12
> > 16 17 18
> > 19 20 21
> > 22 23 24
> > 
> >    NB. insert after row j
> >    (j{.m),7 8 9,j}.m
> > 10 11 12
> >  7  8  9
> > 13 14 15
> > 16 17 18
> > 19 20 21
> > 22 23 24
> >    (<j,_1) C. m,7 8 9
> > 10 11 12
> >  7  8  9
> > 16 17 18
> > 19 20 21
> > 22 23 24
> > 13 14 15
> > 
> > 
> > 
> > ----- Original Message -----
> > From: PackRat <[EMAIL PROTECTED]>
> > Date: Monday, April 28, 2008 20:12
> > Subject: [Jprogramming] BegQ--row deletion/insertion
> > To: Programming forum <[email protected]>
> > 
> > > My brain must have gone into hibernation or something for 
> the 
> > > past 
> > > couple of hours: no matter how much I've searched the 
> > > documentation and 
> > > the forum archives, I cannot seem to find anything about 
> > > deleting a row 
> > > from an array or inserting a row into an array.  I was 
> > > thinking that, 
> > > instead of dropping sequential items from the beginning or 
> end 
> > > (as with 
> > > "drop"), deleting would likely be along the line of a 
> selected 
> > > list of 
> > > one or more items (such as rows) to drop.  (I suppose 
> > > inserting would 
> > > be analogous in some manner.)  However, try as I might, 
> I 
> > > couldn't find 
> > > anything that would seem to be so simple, maybe even a 
> > primitive 
> > > (and 
> > > probably so obvious!)--hence, my frustration with 
> > myself.  
> > > Could some 
> > > kind soul gently share how these would be done?  Thanks 
> > in 
> > > advance!
> > > Harvey
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to