In place operations apply to non named or name-reused data or data that can be "pre-copied", afaiu.
> specifically array classes structured in such a way that you can create a copy which reuses the old unchanged content and then change the contents of this copy Forcing immutable only arrays is not an option for this language if it is to remain compatible with itself, though afaiu, there are optimizations in array&i. array&(-:"n) e.&array Henry once talked about an Optimization O. conjunction that provided hints as to whether data was presorted/unique. I'm unsure that immutable has to be a special optimization hint, because operations, even }, have an (locigcally) immutable (return new array/result) behaviour, and what Henry is working on is conditions where optimizations can reuse the memory. ----- Original Message ----- From: Erling Hellenäs <[email protected]> To: [email protected] Sent: Saturday, October 1, 2016 6:06 AM Subject: [Jprogramming] Non-mutable arrays Hi all ! As I am sure most people here know, functional programmers prefer to use non-mutable data, very often lists. There are also non-mutable arrays. Now, in J development, we talk about operations in place, which seems to go in opposite direction, from the mainly non-mutable arrays we have to mutable arrays. Is there an analysis which shows that this is the right way to go? Another option would be to use non-mutable arrays, specifically array classes structured in such a way that you can create a copy which reuses the old unchanged content and then change the contents of this copy. Usually you can create a mutable array and define its content, then make it non-mutable before you return it. I tried non-mutable array in F#, and they seem slow compared to ordinary arrays, but on some of them a copy operation was very fast. I am not sure of how using such arrays would affect the performance of our systems. Cheers, Erling Hellenäs ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
