Permalink
Fetching contributors…
Cannot retrieve contributors at this time
14 lines (12 sloc) 374 Bytes
(ns ring.util.data
"Miscellaneous functions for manipulating data structures.")
(defn assoc-conj
"Associate a key with a value in a map. If the key already exists in the map,
a vector of values is associated with the key."
[map key val]
(assoc map key
(if-let [cur (get map key)]
(if (vector? cur)
(conj cur val)
[cur val])
val)))