It is sometimes important to merge based on the semantics of the data. Unfortunately, the current merge-with implementation makes you guess based on the datatype (value) what needs to be done. Semantics however requires the knowledge of what the key is that we are trying to merge
e.g. we have an application where a key :messages
is an array and needs to be concatenated while merging, whereas we have a key :tags
that needs to be replaced with the newest value
(merge-with into
{:messages [1 2 3] :tags [1 1 1]}
{:messages [4] :tags [4 4 4]})
=> {:messages [1 2 3 4] :tags [1 1 1 4 4 4]} ;; got
=> {:messages [1 2 3 4] :tags [4 4 4]} ;; expected
there is no way to do this with the current merge-with since it never supplies the key to the merging function