Created
June 14, 2014 21:40
-
-
Save erasmas/56b66b54ca2bfc6272f0 to your computer and use it in GitHub Desktop.
This file contains 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
(defn compare-jobs | |
[m1 m2 key] | |
(loop [keys (clojure.set/intersection (set (keys m1)) (set (keys m2))) | |
changed-jobs {}] | |
(if (empty? keys) | |
changed-jobs | |
(let [name (first keys) | |
status (get-in m1 [name key]) | |
updated-status (get-in m2 [name key])] | |
(if (= status updated-status) | |
(recur (rest keys) changed-jobs) | |
(recur (rest keys) (conj changed-jobs (get m2 name)))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment