Created
June 21, 2018 12:19
-
-
Save loganpowell/865431199709b2edb7a0b6987111fe1f to your computer and use it in GitHub Desktop.
Deep Merge (clj/s)
This file contains hidden or 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
| (defn deep-merge [v & vs] | |
| (letfn [(rec-merge [v1 v2] | |
| (if (and (map? v1) (map? v2)) | |
| (merge-with deep-merge v1 v2) | |
| v2))] | |
| (if (some identity vs) | |
| (reduce #(rec-merge %1 %2) v vs) | |
| v))) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
stolen from: https://gist.github.com/danielpcox/c70a8aa2c36766200a95