Skip to content

Instantly share code, notes, and snippets.

@quux00
Created September 9, 2012 23:27
Show Gist options
  • Save quux00/3687907 to your computer and use it in GitHub Desktop.
Save quux00/3687907 to your computer and use it in GitHub Desktop.
;; 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