Skip to content

Instantly share code, notes, and snippets.

@MrEbbinghaus
Last active August 11, 2022 10:32
Show Gist options
  • Select an option

  • Save MrEbbinghaus/98ff71810a139dee9ee96966008bd6fa to your computer and use it in GitHub Desktop.

Select an option

Save MrEbbinghaus/98ff71810a139dee9ee96966008bd6fa to your computer and use it in GitHub Desktop.
Takes a (nested) map and returns all paths in that map
(fn paths [m]
(reduce-kv
(fn [acc k v]
(into acc
(map vec)
(if (and (associative? v) (not (empty? v)))
(map
#(cons k %)
(paths v))
[[k]])))
#{}
m))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment