All persistent data structures are immutable, but not all immutable data
structures are persistent.

For example, imagine an immutable array that, unlike Clojure's vector data
structure, implemented "conj" by copying the entire array into a new one
with the original elements plus the new one.  Immutable, but the performance
characteristics are abysmal.

As a more subtle example, imagine an immutable array that, unlike Clojure's
vector data structure, let you "update" arbitrary elements, and did not copy
the entire array, but created an imbalanced tree of vector indices that had
their values "updated".  A lookup in this augmented data structure would
require first looking through the imbalanced tree for the index, to see if
it had been modified, and only if it failed to find it in the tree would it
be looked up in the original array.  Immutable, but not persistent in the
sense that it maintains the performance characteristics of the original data
structure -- the augmented/updated data structure has slow access times than
the original.

Andy

On Sun, Sep 25, 2011 at 11:34 AM, Dennis Haupt <d.haup...@googlemail.com>wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> so there is no difference.
>
> Am 25.09.2011 15:28, schrieb Stuart Halloway:
> >> what's the difference between persistent and immutable?
> >
> > See http://en.wikipedia.org/wiki/Persistent_data_structure, which
> > now has a nice shout out to Clojure.
> >
> > Stu
> >
>
>
> - --
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.14 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iQIcBAEBAgAGBQJOf3QyAAoJENRtux+h35aGsKQP/jHBNqhUCQfSQ7XjCe3vTlF5
> zhjcXmyhWbRUF7fEsrmljtpOu630gAnl51cmlBOwpOQXLmGJg386422GzUtRexG3
> A4KcrYEahAKBK5R1Tiu3WMqAr/h3t9oYi6APYaU29qJqqO6lnZR/bp1yAR+wnmZT
> ausVGzUlE+p5DlfWHAMaAsEVYp1XX282BKecgr/cHsBy9Jwl2NdWQl0Ss/ZYPj7x
> JE04/y6T/1jomWdM+dwXZ/oCucWmDjSgg3nHMUy/P9yab0kN2qHprqomBCBQeOpj
> zY5KS2/0x6nS9XpNfKF1f7VdqG8RkVdE+iE14a5uzCWzAQfMbeZUQcyOv8H8QQXU
> v0VYO1htvWwoJRqoCUan5UhrucM+LDqFEml7n8S4y7kbWWy9CJHD0bq9VjgIBIJY
> oo8VrFM7ciO+9mmJ7VfdNmUKPmcclWVFp3PVbNKJVMFXO7s+Myj5y/irWDJ3fBTY
> VYiCKNtbU9uaNZRVfyTQhVF5i+607BfH78S6wA1fEXYWWcvNiwEBoTaKi4cHh6wF
> nbaVf2xOLahJngEg6m8yBQfcnRm5H6WZ2h53UA+c1AgwiRgOAt+FGiK6J695EZbp
> LlslJGUH9QVZXsDVWPthtr2Qk8fJtT7c7UQksfYU+F8lANtyTMcN/kAQ2ngZ2pbq
> aLOthkidIm51E9NkBRH5
> =SNNL
> -----END PGP SIGNATURE-----
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to