Scala中的持久数据结构 [英] Persistent data structures in Scala

查看:132
本文介绍了Scala中的持久数据结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Scala中的所有不可变数据结构是否持久?如果不是,他们是哪些和哪些?持久性的那些行为特征是什么?而且,它们如何与Clojure中的持久数据结构进行比较?

Are all immutable data structures in Scala persistent? If not, which of them are and which not? What are the behavioural characteristics of those which are persistent? Also, how do they compare to the persistent data structures in Clojure?

推荐答案

Scala的不可变数据结构旧值由更新操作维护。事实上,我不知道不可变的和持久的区别;对我来说这两个术语是别名。

Scala's immutable data structures are all persistent, in the sense that the old value is maintained by an `update' operation. In fact, I do not know of a difference between immutable and persistent; for me the two terms are aliases.

Scala的2.8个不可变数据结构中的两个是向量和哈希尝试,表示为32元树。这些最初是由Phil Bagwell设计的,他与我的团队在EPFL工作,然后采用了Clojure,现在终于采用了Scala 2.8。 Scala实现与Clojure实现共享一个公共根,但肯定不是它的端口。

Two of Scala's 2.8 immutable data structures are vectors and hash tries, represented as 32-ary trees. These were originally designed by Phil Bagwell, who was working with my team at EPFL, then adopted for Clojure, and now finally adopted for Scala 2.8. The Scala implementation shares a common root with the Clojure implementation, but is certainly not a port of it.

这篇关于Scala中的持久数据结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆