Created
June 3, 2011 03:46
-
-
Save bdesham/1005837 to your computer and use it in GitHub Desktop.
A Clojure function like flatten, except that it pulls elements out of sets instead of sequences.
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 flatten-sets | |
"Like flatten, but pulls elements out of sets instead of sequences." | |
[v] | |
(filter (complement set?) | |
(rest (tree-seq set? seq (set v))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment