Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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