Data Structures Overview
Persistent collections in one place: vectors, lists, maps, and sets—plus the operations you’ll use most.
Clojure’s core collections are immutable and persistent. Most of the “how do I model this?” questions for Java developers come down to choosing the right collection shape and using the right update functions.
This section gives you a compact view of vectors, lists, maps, and sets, including the operations you’ll see constantly in real code (assoc, update, conj, get, into).
In this section
-
Lists
When to use Clojure’s immutable linked lists (mostly for code and stack-like operations) and how conj/cons/first/rest behave.
-
Vectors
Clojure’s default ordered collection: persistent vectors with fast indexed access, assoc updates, and conj at the end.
-
Maps
Clojure’s go-to “record” type: persistent maps with keyword keys, fast lookup, and immutable assoc/update/merge operations.
-
Sets
Unique collections with fast membership tests: create sets, add/remove items, and use clojure.set for union/intersection/difference.
-
Keywords and Symbols
How keywords and symbols differ: keywords are self-evaluating identifiers (often map keys); symbols resolve to vars/functions.