Open AnthonyJacob opened 7 years ago
How do you provide immutable o(1) array ?
It is obviously a lie but it has some truth in it.
So this is basically a tree, the foundation array need to stay a traditional arrays with o(1) operations, and support thaw-o(1)update(s)-freeze
and will not change structure. However in the future have different array variants would be useful; we already looked into this with the Array of UArray (already available in the repository), which goes in the same direction as what you're talking about here but instead on a hardcoded 2 levels.
The reason I post here this proposal is if I were Haskell beginner and I would be in the situation where list O(N) access and update are no longer fast enough for me I would naturally look into Collection library for something with array or vector in its name with easy mutating and array like characteristics.
As a lazy programmer, I also don't want to thaw and freeze every time unless I have to. For almost all my work true mutable array is overkill, because I don't need that performance.
I don't disagree. this is the plan I'm taking about adding some "Array" variants. It's unlikely to happen straight away, although I have some tree implementations for map/set that are upcoming and could be use as a base for this, but unless someone is willing to look into this, it will probably take some time
Habe you thought about providing immutable update O(1) Array by default like clojure and elm does?