[Jprogramming] insert item

Oleg Kobchenko olegykj at yahoo.com
Fri Aug 24 11:51:55 HKT 2007


   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 <fuchs at mellon.org> 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/


More information about the Programming mailing list