Created
September 9, 2012 23:27
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
;; clojure.core/flatten from | |
;; http://clojuredocs.org/clojure_core/clojure.core/flatten | |
;; Copyright Rich Hickey | |
(defn flatten | |
"Takes any nested combination of sequential things (lists, vectors, | |
etc.) and returns their contents as a single, flat sequence. | |
(flatten nil) returns nil." | |
{:added "1.2" | |
:static true} | |
[x] | |
(filter (complement sequential?) | |
(rest (tree-seq sequential? seq x)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment