admin管理员组文章数量:1291260
Here, José Valim explicitly wrote that it isn't persistent.
But the official documentation here (5th para.) says otherwise, it seems.
I'm confused because I don't know how to check it myself yet. Can anyone help me, please?
Here, José Valim explicitly wrote that it isn't persistent.
But the official documentation here (5th para.) says otherwise, it seems.
I'm confused because I don't know how to check it myself yet. Can anyone help me, please?
Share Improve this question asked Feb 13 at 15:04 al.hramal.hram 13 bronze badges 2- This question is similar to: Does Elixir have persistent data structures similar to Clojure?. If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem. – Starship Commented Feb 13 at 15:31
- I can not find the word "persistent" anywhere in the linked official documentation. – Peaceful James Commented Feb 15 at 13:15
1 Answer
Reset to default 0Elixir tuples and Clojure vectors are both immutable and persistent as defined here:
a data structure that always preserves the previous version of itself when it is modified. Such data structures are effectively immutable, as their operations do not (visibly) update the structure in-place, but instead always yield a new updated structure.
The key difference is efficiency. Any update operation for Elixir tuples such as put_elem
need to copy the whole tuple, meaning they cannot be achieved efficiently and will always be linear. This would disqualify it in practice for most algorithms that would need to run successive updates to build a result.
On the other hand, Clojure vectors, Erlang's :array
or Aja vectors (disclosure: I'm the author) provide efficient update operations that leverage structural sharing and only need to copy the structure partially, typically in logarithmic cost. This series of articles explains the concept well.
本文标签: Stillis tuple now a persistent data structure in Elixir or notStack Overflow
版权声明:本文标题:Still, is tuple now a persistent data structure in Elixir or not? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741527172a2383539.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论