[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Scheme-reports] fresh empty strings
| Date: Sat, 21 Jan 2012 09:38:24 -0500
| From: John Cowan <cowan@x>
| Andy Wingo scripsit:
| > An empty string (vector, bytevector, etc) does not have any
| > locations for the characters, but it does have a location for the
| > length.
| How do you figure that? The length is a value associated with the
| object, certainly, but since it can't be changed (necessarily, not
| just contingently like the locations in a non-empty literal), it
| doesn't seem to me to be a location.
Although not required by the Scheme Reports, an implementation is free
to make the length of a vector or string settable.
-- Function: vector-set-length! object length
Change the length of string, vector, bit-vector, or uniform-array
OBJECT to LENGTH. If this shortens OBJECT then the remaining
contents are lost. If it enlarges OBJECT then the contents of the
extended part are undefined but the original part is unchanged.
It is an error to change the length of literal datums. The new
object is returned.
If (eq? (vector) (vector)), then (vector-set-length! (vector) 3) would
affect all empty vectors, not a good thing.
Scheme-reports mailing list