Lazy length computation in DEFINE-SEQUENCE-TRAVERSER
authorJan Moringen <jmoringe@techfak.uni-bielefeld.de>
Tue, 5 Mar 2013 18:13:06 +0000 (19:13 +0100)
committerChristophe Rhodes <csr21@cantab.net>
Fri, 22 Mar 2013 15:13:15 +0000 (15:13 +0000)
commit768739723a84f1b7c2c1b05f79f19c8e0c602d4b
treea90686fffa1d3d5aa0c3b290bebc5b705c62d472
parent3cd426802c5f093d8d07042b9f180e38b8631c0b
Lazy length computation in DEFINE-SEQUENCE-TRAVERSER

DEFINE-SEQUENCE-TRAVERSER used to unconditionally establish a binding
of LENGTH{,1,2} to the length of the processed sequence(s). This was
wasteful in the case of user-defined sequences whos implementations
could not access this information.

DEFINE-SEQUENCE-TRAVERSER now uses SYMBOL-MACROLET to provide LENGTH{,1,2}
symbols which evaluate to the respective sequence lengths, but the
sequence length is only computed when needed.

Uses of DEFINE-SEQUENCE-TRAVERSER now have to avoid forcing
LENGTH{,1,2} and thus END{,1,2} handling only appears in the list- and
vector-code-paths. The affected sequence functions are REDUCE,
DELETE[-IF[-NOT]], REMOVE[-IF[-NOT]], REMOVE-DUPLICATES,
DELETE-DUPLICATES, SUBSTITUTE[-IF[-NOT]], NSUBSTITUE[-IF[-NOT]],
COUNT[-IF[-NOT]], MISMATCH and SEARCH.
src/code/seq.lisp