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

查看:27
本文介绍了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天全站免登陆