When from-end is specified, start2 becomes end2 and the other way
around, so return star2 or end2 accordingly when testing for an empty
subsequence.
(unless (<= start2 end2 len2)
(oops pattern start2 end2))))
(when (= end1 start1)
- (return-from search start2))
+ (return-from search (if from-end
+ end2
+ start2)))
(do (,(if from-end
'(index2 (- end2 (- end1 start1)) (1- index2))
'(index2 start2 (1+ index2))))
(assert (eql 2
(funcall (lambda ()
(declare (optimize speed))
- (search #(1) #(1 1) :start1 1 :start2 2))))))
+ (search #(1) #(1 1) :start1 1 :start2 2)))))
+ (assert (eql 2
+ (funcall (lambda ()
+ (declare (optimize speed))
+ (search #() #(1 1) :from-end t))))))