David, On Sun, Dec 9, 2012 at 12:34 AM, David Kastrup <d...@gnu.org> wrote: > David Nalesnik <david.nales...@gmail.com> 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 _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user