Re: [Jprogramming] verb to set an element of an array

2017-06-28 Thread Raul Miller
Or, equivalently for those examples: Amend=:(0{::[)`(1{::[)`]} (To make this equivalent for all examples, change the 1 to _1) FYI, -- Raul On Wed, Jun 28, 2017 at 3:47 AM, Erling Hellenäs wrote: > If you don't want to write a new function when you want to insert something > else, you can

Re: [Jprogramming] verb to set an element of an array

2017-06-28 Thread Erling Hellenäs
If you don't want to write a new function when you want to insert something else, you can do like this: Amend=:([:>[:{.[)`([:>[:{:[)`] } (42;1) Amend 1 2 3 1 42 3 (41;2) Amend 0 1 2 0 1 41 (41 42;1 2) Amend 0 1 2 0 41 42 Cheers Erling On 2017-06-23 14:54, Rudolf Sykora wrote: put

Re: [Jprogramming] verb to set an element of an array

2017-06-23 Thread Rudolf Sykora
> put =: (42"_)`[`]} I once again thank all who both answered and supplied extra information on my question. Ruda -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] verb to set an element of an array

2017-06-23 Thread Henry Rich
Also put =: (42"_)`[`]} Henry Rich On 6/23/2017 7:41 AM, Rudolf Sykora wrote: put =: 4 : '42 (x)}y' verb is defined as 3, meaning a monadic verb, but a dyadic verb is needed. Aha! I see. Thanks Ruda -- For information about

Re: [Jprogramming] verb to set an element of an array

2017-06-23 Thread Raul Miller
t; von Rudolf Sykora > Gesendet: Freitag, 23. Juni 2017 11:24 > An: programm...@jsoftware.com > Betreff: [Jprogramming] verb to set an element of an array > > Hello, > > I want to set x'th element of y to 42. > I tried quite a few variations of > > put := verb : '

Re: [Jprogramming] verb to set an element of an array

2017-06-23 Thread Björn Helgason
() are not needed On 23 Jun 2017 11:41, "Rudolf Sykora" wrote: > put =: 4 : '42 (x)}y' > verb is defined as 3, meaning a monadic verb, but a dyadic verb is needed. Aha! I see. Thanks Ruda -- For information about J forums see

Re: [Jprogramming] verb to set an element of an array

2017-06-23 Thread Rudolf Sykora
> put =: 4 : '42 (x)}y' > verb is defined as 3, meaning a monadic verb, but a dyadic verb is needed. Aha! I see. Thanks Ruda -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] verb to set an element of an array

2017-06-23 Thread Björn Helgason
put=: 4 : '42 x}y' 1 put 1 2 3 1 42 3 On 23 Jun 2017 09:23, "Rudolf Sykora" wrote: Hello, I want to set x'th element of y to 42. I tried quite a few variations of put := verb : '42 x}y' but I am still getting 1 put 1 2 3 |domain error: put Can you tell me what is wrong, and tell me how

Re: [Jprogramming] verb to set an element of an array

2017-06-23 Thread Schmidt-Gröttrup , Markus
2017 11:24 An: programm...@jsoftware.com Betreff: [Jprogramming] verb to set an element of an array Hello, I want to set x'th element of y to 42. I tried quite a few variations of put := verb : '42 x}y' but I am still getting 1 put 1 2 3 |domain error: put Can you tell me what

[Jprogramming] verb to set an element of an array

2017-06-23 Thread Rudolf Sykora
Hello, I want to set x'th element of y to 42. I tried quite a few variations of put := verb : '42 x}y' but I am still getting 1 put 1 2 3 |domain error: put Can you tell me what is wrong, and tell me how to do it right? Thanks Ruda -