Skip to content

Instantly share code, notes, and snippets.

@rotaliator
Created October 10, 2022 07:06
Show Gist options
  • Save rotaliator/26d320222d0c6eb24e2743099601006e to your computer and use it in GitHub Desktop.
Save rotaliator/26d320222d0c6eb24e2743099601006e to your computer and use it in GitHub Desktop.
Clojure deep get
(defn deep-get
[m k]
(let [values_ (transient [])]
(walk/prewalk (fn [e] (if (and (map? e) (get e k))
(do (conj! values_ (get e k)) e)
e)) m)
(persistent! values_)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment