An empty first sequence means that (= start1 end1) and it will match
the second sequence anywhere starting from start2, so return start2
in case of (= start1 end1).
(oops pattern start1 end1))
(unless (<= start2 end2 len2)
(oops pattern start2 end2))))
- (when (= 0 end1)
- (return-from search 0))
+ (when (= end1 start1)
+ (return-from search start2))
(do (,(if from-end
'(index2 (- end2 (- end1 start1)) (1- index2))
'(index2 start2 (1+ index2))))
(search x #(t t t) :start2 1 :end2 0 :end1 0)))
#(t t t))
(sb-kernel:bounding-indices-bad-error ()
- :ok)))))
+ :ok))))
+ (assert (eql 1
+ (funcall (lambda ()
+ (declare (optimize speed))
+ (search #() #(1 1) :start2 1 :end2 1)))))
+ (assert (eql 2
+ (funcall (lambda ()
+ (declare (optimize speed))
+ (search #(1) #(1 1) :start1 1 :start2 2))))))