David Nalesnik <david.nales...@gmail.com> writes: > Hi, > > Given the following function, each time an override of NoteHead.color > occurs, a new color from the list is used: > > \version "2.19.30" > > #(define test > (let ((colors (circular-list red green blue yellow darkgreen magenta))) > (lambda () > (let ((color (car colors))) > (set! colors (cdr colors)) > color)))) > > { > \once\override NoteHead.color = #(test) > c''4 > \once\override NoteHead.color = #(test) > c''4
> However, when I put the override within a repeat structure, the override > only seems to happen once: > > %% All darkgreen (we left off with yellow above > { > \repeat unfold 10 { > \once \override NoteHead.color = #(test) > c''4 > } > } > > Is there any way to get the override to be reevaluated with each repeat? No. Written in that manner, the override is evaluated at _input_ time. If you put it in a variable and use that variable 3 times, the colors will be the same each time. What you want is #(define test (let ((colors (circular-list red green blue yellow darkgreen magenta))) (lambda (grob) (let ((color (car colors))) (set! colors (cdr colors)) color)))) and \override NoteHead.color = #test That way you'll get one call per actual _grob_ since then each grob is then initialized with the callback, and the callback is replaced by the value when the property is first used. -- David Kastrup _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user