April 14, 2026

Immutable throwdown, 2013 reboot

Understanding Clojure's Persistent Vectors, pt. 1 (2013)

Clojure’s unchangeable arrays wow fans as Scala says 'we had that'

TLDR: A throwback post explains how Clojure keeps old versions of data intact while staying fast by reusing parts. Commenters praised the simplicity of immutability, Scala fans said their Vector does it too, and Rust got a nod—proof this idea matters because it keeps code safer and easier to reason about.

A classic 2013 explainer on Clojure’s “persistent vectors” is making the rounds again, and the comments are the show. Fans are hyped that you can add or change items without breaking old versions—think a tree of boxes where you only copy the path you touch, not the whole thing. It’s brain-friendly and speed-friendly, inspired by Ideal Hash Trees, and the crowd is here for it.

But the peanut gallery didn’t stay quiet. One camp cheered this as peak Clojure, with a top comment gushing that immutable-by-default (unchangeable data) keeps programs sane: you don’t have to track who “owns” a value. Another camp waved the “we had it too” banner, pointing to Scala’s Vector and quipping that “something was in the air in 2013.” Cue friendly flexing over who did what first, while someone name-dropped Rust as a totally different path—same destination, fewer headaches. The mood? Playful rivalry with a side of nostalgia, plus a few wink-wink jokes about 2013 tech trends refusing to die. Verdict from the thread: whether you’re Team Clojure, Team Scala, or just here for the drama, unchangeable data structures are the quiet power move—less chaos, more calm—and everyone wants credit for discovering that first.

Key Points

  • Clojure’s persistent vectors provide practically O(1) appends, updates, lookups, and subvec while remaining persistent (immutable).
  • The structure uses a balanced, ordered tree with interior nodes pointing to subnodes and leaves holding elements, all leaves at the same depth.
  • Persistence is achieved via path copying: nodes along the update/insert path and the target leaf are copied and modified.
  • Structural sharing allows multiple vectors to share nodes, reducing memory usage and copying.
  • Clojure’s PersistentVector includes further optimizations such as transients and tails, to be discussed in later posts; this installment focuses on updates (via assoc), appends, and popping basics.

Hottest takes

"Scala has a similar data structure" — goldfishgold
"Something was in the air in 2013." — goldfishgold
"this is one of the coolest aspects of Clojure" — gleenn
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.