[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Aleatoric / modern notation
From: |
David Nalesnik |
Subject: |
Re: Aleatoric / modern notation |
Date: |
Mon, 10 Dec 2012 20:45:06 -0600 |
David,
On Sun, Dec 9, 2012 at 12:34 AM, David Kastrup <address@hidden> wrote:
> David Nalesnik <address@hidden> writes:
>
>> It turns out that the my definition of event-drul as '(() . ()) was
>> the problem. I substituted (cons '() '()) and everything works just
>> fine...even with the file that gave you the issues with multiple
>> staves. I don't understand why '(() . ()) and (cons '() '()) aren't
>> equivalent.
>
> The problem is rather that '(() . ()) is equivalent, like eq?, with
> itself. It is a constant, meaning that on a second run, the _same_ cons
> cell is being used as in the first run, even if you changed its car and
> cdr in the mean time.
>
> (cons '() '()) allocates a new cons cell for every run. '() itself is
> not a pair and so it is immutable and not susceptible to this problem.
>
Thank you for this explanation. I've searched around for more
information about Scheme constants, and learned that an error message
ought to be returned when applying set-car! and the like to a
constant. However, using the guile sandbox I'm able to do this:
guile> (define my-constant-pair '(73 . 88))
guile> (set-car! my-constant-pair 3)
guile> my-constant-pair
(3 . 88)
(I'm trying an example given here:
http://jayreynoldsfreeman.com/Aux/Tutorials/Modifying%20Lists.html)
I don't understand this--because clearly using set-car! and set-cdr!
with a constant led to problems within the engraver; why will the
sandbox allow me to do this?
-David