[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fill-pointers and sequences
- To: Common-Lisp@SU-AI.ARPA
- Subject: Fill-pointers and sequences
- From: David A. Moon <Moon@SCRC-STONY-BROOK.ARPA>
- Date: Wed, 20 Nov 85 17:14 EST
Consider this code:
(setq a (make-array 10 :fill-pointer 3))
(fill a nil :start (fill-pointer a) :end (array-dimension a 0))
Is this correct Common Lisp? In our implementation this signals an
error that you are accessing outside the bounds of the sequence, but
I believe that is not correct. It is accessing outside the bounds
of the sequence, defined by its fill-pointer, but it is not accessing
outside the bounds of the array.
An example application would be filling the part of a array past its
fill-pointer with its initial-element, so the garbage collector doesn't
have to preserve objects referenced by leftover array contents there.
I checked the Common Lisp manual carefully, and it never says what the
legal values for the :start and :end arguments to a sequence function
are, except that :start must not be > than :end. :end defaults to the
fill-pointer, but it is not clear that it is an error for :end to be
specified larger than the fill-pointer. Perhaps the answer depends on
exactly how we are to interpret the use of the word "subsequence" in the
first sentence of the last paragraph on page 246. Does the answer
depend on whether the sequence function in question is one that writes
(like FILL or REPLACE) or one that reads (like POSITION or REMOVE)?
Does anyone have an opinion to offer?