[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

constants in Scheme

I still don't quite understand which objects are considered immutable in
Scheme.  The standard says "The constants and the strings returned by
symbol->string are then the immutable objects, while all objects created
by the other procedures in this Standard are mutable".

Does this mean that objects returned by, say, "read" are mutable?
Is the expression

    (string-set! (read) 0 #\a))

legal, when the call to (read) returns a non-empty string?  And what about
the elements of a vector constant?  Is

   (set-car! (vector-ref '#((a b) c) 0) 'd)


By the way, why must vector constants be quoted?  Does the evaluation
of a vector constant ever return a result?

Oliver Laumann     net@TUB.BITNET     net@tub.cs.tu-berlin.de     net@tub.UUCP