-
-
Save curtosis/06c415f03115de06e676 to your computer and use it in GitHub Desktop.
nested filtered map
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 unsaturated-diffs [cuis diffs-by-parent] | |
(let [cuiset (set cuis) | |
cui-in-note? (fn [cui] | |
(contains? cuiset (:cui_id cui))) | |
some-fully-saturated-diff (fn [diffs] | |
(some | |
(fn [[_ grouped-diffs]] | |
(every? cui-in-note? grouped-diffs)) | |
(group-by :diff__code diffs)))] | |
(reduce-kv (fn [m k v] | |
(if-not (some-fully-saturated-diff v) | |
(assoc m k v) | |
m)) | |
{} | |
diffs-by-parent))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment