(assoc coll k v)
(assoc coll k v & 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.
Source
(defn
assoc
"assoc[iate]. When applied to a map, returns a new map of the\n same (hashed/sorted) type, that contains the mapping of key(s) to\n val(s). When applied to a vector, returns a new vector that\n contains val at index."
([coll k v] (if-not (nil? coll) (-assoc coll k v) (array-map k v)))
([coll k v & kvs]
(let
[ret (assoc coll k v)]
(if kvs (recur ret (first kvs) (second kvs) (nnext kvs)) ret))))