Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hyone/1056329 to your computer and use it in GitHub Desktop.
Save hyone/1056329 to your computer and use it in GitHub Desktop.
4clojure #69 - Merge with a Function
;; 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