David Nalesnik <[email protected]> writes: > All spanners appear when I replace the variable definition > (event-drul '(() . ())) > > with > > (cons (list) (list)) > > and later (line 157): > > (set! event-drul '(() . ())) > > with > > (set! event-drul (cons (list) (list))) > > I'd like to fix the problem, but I have several questions: > > (1) Would (cons '() '()) be acceptable? The problem is fixed, but I wonder > about the > usage of the literal expression '() since there are multiple usages of > set-car! and set-cdr! applied to the variable.
That's a misconception. You can't apply set-car! or set-cdr! to '() since '() has neither car nor cdr, not being a pair. > (2) Should '() in all variable definitions, set! expressions be changed to > (list) ? No, '() is just fine and safe. It is a constant like 7, #t or #f and can't be modified at all. '(() ()) however is a pair. Both its car and cdr are the constant '() (which can't be changed), but you can replace its car and cdr. Which is undefined behavior: Scheme is free to throw an error or actually change the code in every instance or do other nasties. So with (cons '() '()) you should be fine. IIRC, completize-grob-entry running on all-grob-descriptions also commits this kind of sacrilege. -- David Kastrup _______________________________________________ lilypond-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/lilypond-devel
