summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2009-02-18 02:53:13 +0000
committerRich Hickey <richhickey@gmail.com>2009-02-18 02:53:13 +0000
commit38578424ae193dd87a6aef7f4296f22049a2dfbc (patch)
tree7e1258906a9244d51342f520bfc719b521c0fd26 /src
parentc6ecc887dc0bfc332e1a1c23ecf9658ff38cda9e (diff)
fixed (cycle [])
Diffstat (limited to 'src')
-rw-r--r--src/clj/clojure/core.clj4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj
index b494b836..eb0c53e4 100644
--- a/src/clj/clojure/core.clj
+++ b/src/clj/clojure/core.clj
@@ -1566,7 +1566,9 @@
(defn cycle
"Returns a lazy (infinite!) sequence of repetitions of the items in coll."
- [coll] (lazy-seq (concat coll (cycle coll))))
+ [coll] (lazy-seq
+ (when-let [s (seq coll)]
+ (concat s (cycle s)))))
(defn split-at
"Returns a vector of [(take n coll) (drop n coll)]"