Is the Vector
in Haskell structure sharing? In Clojure, modifying the (immutable) vector
only takes O(log n) time because it is actually a trie-like structure. (http://hypirion.com/musings/understanding-persistent-vector-pt-1)
Is there an equivalent implementation in Haskell?
Data.Vector
is plain arrays with O(n) modification.
At the time there is no equivalent of Clojure's vector.
Data.Sequence
is implemented as a finger tree, and it supports a wider range of asymptotically efficient operations than Clojure's vector (O(log(n)) concatenation and splitting, O(1) read/write at both ends), but it's also a bit more heavyweight data structure with more RAM usage and some constant overheads.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With