@Jon -- let me draw your attention to an ongoing discussion in the J
programming forum on this very topic:
"Tacit J and indexed replacement"
http://www.jsoftware.com/pipermail/programming/2014-July/037968.html
Right now we're discussing Amend } and its (perceived) ill-adaptation to
the tasks it's (apparently) meant for.

IanClark


On Wed, Jul 9, 2014 at 4:32 AM, Jon Hough <[email protected]> wrote:

> Ok, I see now. It's just using ammend. It was there in nuvoc the whole
> time. Not sure how I missed that.
>
> Thanks.
>
> --- Original Message ---
>
> From: "'Pascal Jasmin' via Programming" <[email protected]>
> Sent: July 9, 2014 11:52 AM
> To: [email protected]
> Subject: Re: [Jprogramming] Modifying single element of List or Table
>
>    (<'fish') 2} ;: 'cat dog fiosh cow monkey'
> ┌───┬───┬────┬───┬──────┐
> │cat│dog│fish│cow│monkey│
> └───┴───┴────┴───┴──────┘
>    5 (4 5 6}) 3 1 4 1 7 9 2 6 5
> 3 1 4 1 5 5 5 6 5
>
>
>
>
> ________________________________
> From: Jon Hough <[email protected]>
> To: "[email protected]" <[email protected]>
> Sent: Tuesday, July 8, 2014 10:31:03 PM
> Subject: [Jprogramming] Modifying single element of List or Table
>
>
>
> I want to modify an element of a list, leaving other elements unchanged.
>
> e.g.
>
>
>
>    list =. ;: 'cat dog fiosh cow monkey'
>
>
> list
>
>
> ┌───┬───┬─────┬───┬──────┐
> │cat│dog│fiosh│cow│monkey│
> └───┴───┴─────┴───┴──────┘
>
>
> I want to change 'fiosh' to 'fish', e.g. change a spelling mistake. It
> would also be preferable to do this in-place because I don't want to copy
> the list.
>
> Or, another example,
>
>
> arr =. 3 1 4 1 7 9 2 6 5
>
>    arr
>
> 3 1 4 1 7 9 2 6 5
>
> I want  4{arr to become 5, not 7. How can I do this modification? This
> seems simple, but I just realized I don't know how to do it in J.
>
> Regards.
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> 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