Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
6
Task/Flatten-a-list/Clojure/flatten-a-list-1.clj
Normal file
6
Task/Flatten-a-list/Clojure/flatten-a-list-1.clj
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
(defn flatten [coll]
|
||||
(lazy-seq
|
||||
(when-let [s (seq coll)]
|
||||
(if (coll? (first s))
|
||||
(concat (flatten (first s)) (flatten (rest s)))
|
||||
(cons (first s) (flatten (rest s)))))))
|
||||
3
Task/Flatten-a-list/Clojure/flatten-a-list-2.clj
Normal file
3
Task/Flatten-a-list/Clojure/flatten-a-list-2.clj
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
(defn flatten [x]
|
||||
(filter (complement sequential?)
|
||||
(rest (tree-seq sequential? seq x))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue