Skip to content

Instantly share code, notes, and snippets.

@loganpowell
Created June 21, 2018 12:19
Show Gist options
  • Select an option

  • Save loganpowell/865431199709b2edb7a0b6987111fe1f to your computer and use it in GitHub Desktop.

Select an option

Save loganpowell/865431199709b2edb7a0b6987111fe1f to your computer and use it in GitHub Desktop.
Deep Merge (clj/s)
(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)))
@loganpowell
Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment