[CM] reader macro vector peculiarities
Christos Vagias
chris.actondev at gmail.com
Tue Feb 22 12:51:56 PST 2022
Hi Bil,
I stumbled upon something interesting:
(let ()
(define x #(0 0))
(define (reset)
(set! x #(0 0)))
(set! (x 0) 1)
(reset)
(set! (x 1) 2)
(reset)
x)
The x being returned is #(0 2).
(Let's ignore the inefficient reset code).
I'm guessing that in the reset lambda the #(0 0) is expanded to a cell
which is captured in the lambda body & reused later on.
Checking with guile, it complains about vector-set!: Wrong type argument in
position 1 (expecting mutable vector): #(0 0)
So apparently in guile with (define x #(0 0)), x is an immutable vector.
Hope this is helpful, not like yesterday!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cm-mail.stanford.edu/pipermail/cmdist/attachments/20220222/914c0b88/attachment.html>
More information about the Cmdist
mailing list