Why it matters

Persistent structures enable functional programming without copying. Understanding shapes efficient immutable code.

Advertisement

The architecture

Path copying: only nodes on modified path copied; rest shared.

Fat nodes: version info per change.

Persistent updatesModify pathcopy touched nodesShare restwith prior versionNew rootrepresents new versionLog n additional memory per update; access any version in log time
Persistent tree modification.
Advertisement

How it works end to end

Persistent stack: node with value + pointer to previous top.

Persistent tree: modify only path from root; share subtrees.

Confluently persistent: merge versions.

Applications: Git, Clojure/Scala/Immutable.js collections.