[CM] reader macro vector peculiarities

bil at ccrma.Stanford.EDU bil at ccrma.Stanford.EDU
Tue Feb 22 13:09:03 PST 2022


The #(0 0) business returns a read-time vector
That means when you assign it to x, x is now
exactly the same vector as is in the reset body,
so when you set some element of it via (set! (x...)...)
you are changing the vector sitting in the
reset function.  To avoid this, use (vector 0 0)
in reset -- the vector function makes a new
vector each time it is called.  The same problem
affects any sequence (like a string constant, or
a quoted list).  I think there's something about
this in s7.html -- will have to look around,
and lint will complain about it.



More information about the Cmdist mailing list