]arr =. 3 1 4 1 7 9 2 6 5
3 1 4 1 7 9 2 6 5
   5 (<4) } arr
3 1 4 1 5 9 2 6 5


On Tuesday, July 8, 2014, Jon Hough <[email protected]> wrote:

>
> 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



-- 
Sent from Gmail Mobile
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to