File tree 2 files changed +14
-8
lines changed
2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -5524,9 +5524,10 @@ reduces them without incurring seq initialization"
5524
5524
5525
5525
IFind
5526
5526
(-find [coll n]
5527
- (when (and (not (neg? n))
5528
- (< (+ start n) end))
5529
- (-find v (+ start n))))
5527
+ (when-not (neg? n)
5528
+ (let [idx (+ start n)]
5529
+ (when (< idx end)
5530
+ [n (-lookup v idx)]))))
5530
5531
5531
5532
IVector
5532
5533
(-assoc-n [coll n val]
Original file line number Diff line number Diff line change 99
99
(testing " rseq equality"
100
100
(is (= (rseq sv1) '(1 )))
101
101
(is (nil? (rseq sv2)))))
102
- (let [s (subvec [0 1 2 3 ] 0 2 )]
102
+ (let [sv1 (subvec [0 1 2 3 ] 0 2 )
103
+ sv2 (subvec [0 1 2 3 ] 1 3 )]
103
104
(testing " IFind"
104
- (is (= (find s 0 ) [0 0 ]))
105
- (is (= (find s 1 ) [1 1 ]))
106
- (is (= (find s 2 ) nil ))
107
- (is (= (find s -1 ) nil ))))
105
+ (is (= (find sv1 0 ) [0 0 ]))
106
+ (is (= (find sv1 1 ) [1 1 ]))
107
+ (is (= (find sv1 2 ) nil ))
108
+ (is (= (find sv1 -1 ) nil ))
109
+ (is (= (find sv2 0 ) [0 1 ]))
110
+ (is (= (find sv2 1 ) [1 2 ]))
111
+ (is (= (find sv2 2 ) nil ))
112
+ (is (= (find sv2 -1 ) nil ))))
108
113
)
109
114
))
110
115
You can’t perform that action at this time.
0 commit comments