On 8/23/07, Dan Baronet <[EMAIL PROTECTED]> wrote:
> How about using /: as in
>
> ins=: 1 : 0
> :
> (/:(1+j.m),i.#y){x,y
> )
I think that j. is spurious. In other words, I think you meant:
ins=: 1 : 0
:
(/:(1+m),i.#y){x,y
)
Note also that Dan's code has a significant advantage over mine:
his does the right thing when the same index position is repeated.
'au' 1 1 ins 'Rl'
Raul
Though, as he implies, a changed interpretation for the index argument
(insert to the left rather than the right) is probably simpler in the long run
(this way the left most position is 0 rather than _1):
ins0=: 1 : 0
:
(/:m,i.#y){x,y
)
'--> ' 0 0 0 0 ins0 'tt' 2 2 ins0 'ee' 1 1 ins0 'Br'
--> Better
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm