File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -8430,11 +8430,10 @@ reduces them without incurring seq initialization"
8430
8430
8431
8431
ISeqable
8432
8432
(-seq [rng]
8433
- (if (pos? step)
8434
- (when (< start end)
8435
- rng)
8436
- (when (> start end)
8437
- rng)))
8433
+ (cond
8434
+ (pos? step) (when (< start end) rng)
8435
+ (neg? step) (when (> start end) rng)
8436
+ :else (when-not (== start end) rng)))
8438
8437
8439
8438
ISeq
8440
8439
(-first [rng]
Original file line number Diff line number Diff line change 1221
1221
(is (= (range 0 -3 -1 ) (list 0 -1 -2 )))
1222
1222
(is (= (range 3 0 -1 ) (list 3 2 1 )))
1223
1223
(is (= (range 0 10 -1 ) (list )))
1224
- (is (= (range 0 1 0 ) (list )))
1224
+ (is (= (take 3 ( range 0 1 0 )) (list 0 0 0 )))
1225
1225
(is (= (range 10 0 1 ) (list )))
1226
1226
(is (= (range 0 0 0 ) (list )))
1227
1227
(is (= (count (range 0 10 -1 )) 0 ))
1228
- (is (= (count (range 0 1 0 )) 0 ))
1228
+ (is (= (count (take 3 ( range 0 2 0 ))) 3 ))
1229
1229
(is (= (count (range 10 0 1 )) 0 ))
1230
1230
(is (= (count (range 0 0 0 )) 0 ))
1231
1231
(is (= (take 3 (range 1 0 0 )) (list 1 1 1 )))
You can’t perform that action at this time.
0 commit comments