Isn't this what you mean?

   ins1=: 1 : ',&.(m&|.)'

   _1 (1) ins i.3 4
 0  1  2  3
_1 _1 _1 _1
 4  5  6  7
 8  9 10 11

   4 (2) ins a=:2 3 5 6  NB. the original example.
5 6 4 2 3

   4 (2) ins1 a=:2 3 5 6 
2 3 4 5 6


R.E. Boss


> -----Oorspronkelijk bericht-----
> Van: [EMAIL PROTECTED] [mailto:programming-
> [EMAIL PROTECTED] Namens Oleg Kobchenko
> Verzonden: vrijdag 24 augustus 2007 5:52
> Aan: Programming forum
> Onderwerp: Re: [Jprogramming] insert item
> 
>    ins=: 1 : '(-m)|.,'
> 
>    _1 (3) ins 1 2 3
> 1 2 3 _1
> 
>    _1 (0) ins 1 2 3
> _1 1 2 3
> 
>    _1 (1) ins i.3 4
>  8  9 10 11
> _1 _1 _1 _1
>  0  1  2  3
>  4  5  6  7
> 
> 
> --- Fuchs Ira <[EMAIL PROTECTED]> wrote:
> 
> > Very elementary question:
> >
> > Is there a primitive verb which will insert a value in a list?  That
> > is, given an index, a new value , and a list, the verb would insert
> > the value in the list after the index location.
> >
> > for example if a=:2 3 5 6 and I want to insert a 4 after in the 3rd
> > position, I can say (2{.a) ,4 ,2}.a
> >
> > Is there a primitive verb to do this?  If not, what is the simplest
> > definition for doing this?
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> 
> 
> 
> 
> __________________________________________________________________________
> __________
> Choose the right car based on your needs.  Check out Yahoo! Autos new Car
> Finder tool.
> http://autos.yahoo.com/carfinder/
> ----------------------------------------------------------------------
> 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