Clojure’s default ordered collection: persistent vectors with fast indexed access, assoc updates, and conj at the end.
Vectors are Clojure’s default choice for ordered data. They’re persistent (immutable with structural sharing) and provide fast indexed access—similar to an immutable ArrayList.
1[1 2 3]
2(vector 1 2 3)
1(def v [10 20 30])
2
3(get v 1) ; => 20
4(nth v 1) ; => 20
5(v 1) ; => 20 ; vector-as-function lookup
1(assoc [10 20 30] 1 99) ; => [10 99 30]
2(conj [1 2] 3) ; => [1 2 3] ; vectors conj at the end
peek / pop)1(peek [1 2 3]) ; => 3
2(pop [1 2 3]) ; => [1 2]
subvec1(subvec [0 1 2 3] 1 3) ; => [1 2]
subvec uses start/end indexes and the end is exclusive (like Java’s substring and many slice APIs).