Created
November 25, 2014 17:28
-
-
Save dustingetz/dcf0498d1cc48de26bae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns streaker-service.util) | |
(defn deep-merge | |
"Recursively merges maps. If vals are not maps, the last value wins. | |
(from https://groups.google.com/forum/#!topic/clojure/UdFLYjLvNRs)" | |
[& vals] | |
(if (every? map? vals) | |
(apply merge-with deep-merge vals) | |
(last vals))) | |
(comment | |
(deep-merge {:a "a" | |
:b {:bb "bb"}} | |
{:a 10 | |
:b {:bc "bc"} | |
:c 20}) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment