clojure.core/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.
Examples¶
Note by udkl¶
When to use assoc, conj, merge¶
assoc, conj & merge behave very differently for different data structures
If you are writing a function that can handle multiple kinds of collections, then your choice will make a big difference.
Treat merge as a maps-only function (its similar to conj for other collections).
My opinion:
assoc- use when you are 'changing' existing key/value pairsconj- use when you are 'adding' new key/value pairsmerge- use when you are combining two or more maps
Ref : https://stackoverflow.com/a/3204346
Note by rainspeaker¶
Merge is more similar to concat than to conj IMO.
See also¶
Content from the matching ClojureDocs page, with authors credited on each contribution.