Permalink
Browse files

CLJS-724: Range -first bug

Don't return start if Range is empty
  • Loading branch information...
swannodette committed Dec 11, 2013
1 parent 8943faf commit 69f3a390df4a954d49077bfd67200aac18d8cd99
Showing with 6 additions and 1 deletion.
  1. +2 −1 src/cljs/cljs/core.cljs
  2. +4 −0 test/cljs/cljs/core_test.cljs
View
@@ -6418,7 +6418,8 @@ reduces them without incurring seq initialization"
rng)))
ISeq
- (-first [rng] start)
+ (-first [rng]
+ (when-not (nil? (-seq rng)) start))
(-rest [rng]
(if-not (nil? (-seq rng))
(Range. meta (+ start step) end step nil)
@@ -2033,5 +2033,9 @@
(assert (= (apply list (drop-while (partial = 1) [1 2 3])) '(2 3)))
(assert (= (set (drop 1 #js [1 2 3])) #{2 3}))
+ ;; CLJS-724
+
+ (assert (nil? (first (rest (rest (rest (range 3)))))))
+
:ok
)

0 comments on commit 69f3a39

Please sign in to comment.