Skip to content

Instantly share code, notes, and snippets.

Created June 30, 2011 14:20
Show Gist options
  • Save anonymous/1056328 to your computer and use it in GitHub Desktop.
Save anonymous/1056328 to your computer and use it in GitHub Desktop.
;; hyone's solution to Merge with a Function
;; https://4clojure.com/problem/69
(fn my-merge-with [f & maps]
(reduce
(fn [a b]
(reduce
(fn [x [k v]]
(assoc x k (if (b k) (f v (b k)) v)))
b a))
(first maps) (rest maps)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment