They're functional! They're efficient!!
summary
Persistent data structures keep old versions intact while reusing unchanged parts to save time and memory, implemented as trees (tries) that copy only nodes on the path to a changed leaf rather than whole arrays. That yields structural sharing, far fewer copies than naive immutability, and update cost tied to tree depth not length (useful with branching factors like 32). JavaScript options mentioned include mori (a ClojureScript port) and Immutable.js from Facebook, and the approach demonstrably reduces allocations and runtime.
AI-written summary · about
chapters (6)
- 0:00Introduction to persistence
- 1:36The problem with mutability
- 3:46Immutability and copying
- 5:01Understanding persistence
- 6:42Tree-based structural sharing
- 9:31Implementation and resources
related talks
34mImmutability: Putting The Dream Machine To Work
37mVisualizing Persistent Data Structures
28mPersistent data structures - good for UI
19mImmutability is Changing: From Immutable.js to Immer
39mData structures for frontend developers
10mFunctional Programming for Everyone
01h 03mFunctional Programming in JavaScript
32mEditing Trees with Zippers
