clojure.core/assoc-in¶
Associates a value in a nested associative structure, where ks is a sequence of keys and v is the new value and returns a new nested structure. If any levels do not exist, hash-maps will be created.
Examples¶
Note by Crowbrammer¶
Unlike assoc, you can only do one kv at a time:
;; Allowed
(assoc {} :a "a" :b "b" :c "c")
;; Not allowed:
(assoc-in {} [:a :b] "cya" [:a :d :e] "f" [:b :g] "wow")
See also¶
- clojure.core/assoc (8)
- clojure.core/update-in (10)
- clojure.core/get-in (5)
- clojure.core/associative?
Content from the matching ClojureDocs page, with authors credited on each contribution.