Skip to content

Instantly share code, notes, and snippets.

@shayanjm
Created June 29, 2014 06:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shayanjm/9702996c62ef46e8fc1e to your computer and use it in GitHub Desktop.
Save shayanjm/9702996c62ef46e8fc1e to your computer and use it in GitHub Desktop.
(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