Created
June 14, 2017 08:16
-
-
Save Frozenlock/1c75e0d52d1a51c0e5381e2a0dd5a252 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 build-paths | |
"Given a tree (map), return all the paths leading to a value." | |
[m] | |
(->> (for [[k v] m] | |
(if (map? v) | |
(map #(cons k %) (build-paths v)) | |
[[k]])) | |
(apply concat))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment