Skip to content

Instantly share code, notes, and snippets.

@erasmas
Created June 14, 2014 21:40
Show Gist options
  • Save erasmas/56b66b54ca2bfc6272f0 to your computer and use it in GitHub Desktop.
Save erasmas/56b66b54ca2bfc6272f0 to your computer and use it in GitHub Desktop.
(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