You're viewing version 1.2.0 of merge. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16

merge

clojure.core

  • (merge & maps)
Returns a map that consists of the rest of the maps conj-ed onto
the first. If a key occurs in more than one map, the mapping from
the latter (left-to-right) will be the mapping in the result.

1 Example top

  • user=> (merge {:a 1 :b 2 :c 3} {:b 9 :d 4})
    {:d 4, :a 1, :b 9, :c 3}
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:2268 top

(defn merge
  "Returns a map that consists of the rest of the maps conj-ed onto
  the first.  If a key occurs in more than one map, the mapping from
  the latter (left-to-right) will be the mapping in the result."
  {:added "1.0"}
  [& maps]
  (when (some identity maps)
    (reduce #(conj (or %1 {}) %2) maps)))
Vars in clojure.core/merge: conj defn identity or reduce some when

Comments top

No comments for merge. Log in to add a comment.