Skip to content

Instantly share code, notes, and snippets.

@noahlz
Created November 16, 2012 03:58
Show Gist options
  • Save noahlz/4083907 to your computer and use it in GitHub Desktop.
Save noahlz/4083907 to your computer and use it in GitHub Desktop.
;; See https://twitter.com/stevelosh/status/269269366992936960
(defn multi-update [m updates]
(reduce (fn [m [k f & args]]
(update-in m k #(apply f % args)))
m updates))
;; user=> (multi-update {:a 1 :b 2 :c 3} [[[:a] 1 1 1][[:b] 1 1][[:c] 3 1 -2]])
;; {:a 4, :c 5, :b 4}
@noahlz
Copy link
Author

noahlz commented Nov 16, 2012

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