Re:Copying data is wasteful, mutating data is dangerous
by pipeep on Thursday January 09, 2020 @05:27PM
(#22006572)
If the data structure has a reference count of one, you can safely mutate the data structure instead. Many persistent immutable data structure libraries use this as an additional optimization.
Re:Copying data is wasteful, mutating data is dangerous
by capableweb on Thursday January 09, 2020 @02:31PM
(#22004635)
I missed that, sorry. Thanks for clarifying!
you don't get much benefit from persistent structures if every element of an array is modified, like in the examples in the post.