Skip to content

Instantly share code, notes, and snippets.

@amalloy
Created October 8, 2012 00:37
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 amalloy/3850118 to your computer and use it in GitHub Desktop.
Save amalloy/3850118 to your computer and use it in GitHub Desktop.
(let [m '{a {b {c v1, d v2, e v3}, f v4}}]
((fn walk-leaves [parents m]
(lazy-seq
(if-not (map? m)
(list (conj parents m))
(for [[k v] m
leaf (walk-leaves (conj parents k) v)]
leaf))))
[] m))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment