function | since v0.0-927 | clojure.core/zipmap | Edit |
(zipmap keys vals)
Returns a map with keys
mapped to corresponding vals
.
user=> (zipmap [:a :b :c :d] [1 2 3 4]) {:a 1, :b 2, :c 3, :d 4}
Returns a map with the keys mapped to the corresponding vals.
(defn zipmap
[keys vals]
(loop [map (transient {})
ks (seq keys)
vs (seq vals)]
(if (and ks vs)
(recur (assoc! map (first ks) (first vs))
(next ks)
(next vs))
(persistent! map))))