Hacker News new | past | comments | ask | show | jobs | submit login

From Wikipedia [1]:

    a persistent data structure is a data structure that always preserves the previous version of itself when it is modified
So when you do an insert, you get back a new array with the inserted value, and the old array is (as far as external visibility) untouched.

An immutable array is just an array that never changes. A persistent array allows you to do operations on immutable arrays which returns new immutable arrays that is the old immutable array with the operation performed.

[Edit] As sgk284 pointed out elsewhere in the thread, my last paragraph mischaracterises the situation slightly.

An immutable array with any operations defined on it will necessarily be persistent, so it was misleading to say 'is _just_ an array that never changes'.

[1] http://en.wikipedia.org/wiki/Persistent_data_structure




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: