ClojureDocs

Nav

Namespaces

Clojure/Conj 2026 — Charlotte, NC — Sept 30 - Oct 2 Learn More & Get Tickets →

assoc

clojure.core

Available since 1.0 (source)
  • (assoc map key val)
  • (assoc map key val & kvs)
assoc[iate]. When applied to a map, returns a new map of the
  same (hashed/sorted) type, that contains the mapping of key(s) to
  val(s). When applied to a vector, returns a new vector that
  contains val at index. Note - index must be <= (count vector).