9 Persistent data structures
Standing on the shoulders of giants
This chapter covers
- The internal details of persistent data structures
- The time and memory efficiency of persistent data structures
- Using persistent data structures in an application
In part 1, we illustrated how to manage the state of a system without mutating data, where immutability is maintained by constraining ourselves to manipulate the state only with immutable functions using structural sharing. In this chapter, we present a safer and more scalable way to preserve data immutabilityârepresenting data with so-called persistent data structures. Efficient implementations of persistent data structures exist for most programming languages via third-party libraries.