-
-
Save shayanjm/9702996c62ef46e8fc1e 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 all-values-of-key | |
[key map] | |
(reduce-kv (fn [acc k v] | |
(cond (= k key) | |
(cons v acc) | |
(and (map? v) (contains? v key)) | |
(concat acc (all-values-of-key key v)) :else acc)) '() map)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment