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

Reply via email to