Comment 2 for bug 452008

Revision history for this message
Nikodemus Siivola (nikodemus) wrote :

Thanks for the patch! However:

+ (if (and end (or (> start end)
+ (> end (length sequence))))
+ (sequence-bounding-indices-bad-error
+ sequence start end)

is not good: LENGTH is O(N), and doesn't work at all on circular lists -- but FIND and POSITION should work fine on circular lists as long as the item _is_ in the list, and we'd rather not walk the entire list twice even if is is not circular.

The correct way to do this is to write the list walking using eg. DO instead of DOLIST, and check the bounds on the fly.