-
-
Save clifford/0864cdfdfc5f639b5628 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def msgs [ {"a" {:stat1 1 :stat2 10} "b" {:stat1 1}} {"a" {:stat1 1}}]) | |
(def merged (apply merge-with (partial merge-with +) msgs)) | |
;; {"a" {:stat1 2, :stat2 10}, "b" {:stat1 1}} | |
(prn merged) | |
;; {"a" {:stat1 2, :stat2 10}, "b" {:stat1 1}} | |
(= (-> merged first second :stat1) 2) | |
;; true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment