logo
首页技术栈工具库讨论
persistent-vector

persistent-vector

This package provides persistent vectors based on array mapped tries. The implementation is based on the persistent vectors used in clojure, but in a Haskell-style API. The API is modeled after Data.Sequence from the containers library. Technically, the element-wise operations are O(log(n)), but the underlying tree cannot be more than 7 or 8 levels deep so this is effectively constant time. One change from the clojure implementation is that this version supports O(1) slicing, though it does cheat a little. Slices retain references to elements that cannot be indexed. These extra references (and the space they occupy) can be reclaimed by shrinking the slice. This seems like a reasonable tradeoff, and, I believe, mirrors the behavior of the vector library. Highlights: O(1) append element, indexing, updates, length, and slicing Reasonably compact representation
由 
bruceshi2021-01-13 收录
--
推荐
不推荐
更多信息
HACKAGE
carbal install persistent-vector
查看
标签
根据用户添加的标签生成
暂无标签