On Sun, Nov 22, 2015 at 2:18 PM, David Nalesnik <david.nales...@gmail.com>
wrote:

>
>
> On Sun, Nov 22, 2015 at 2:15 PM, Thomas Morley <thomasmorle...@gmail.com>
> wrote:
>
>> 2015-11-22 20:49 GMT+01:00 David Nalesnik <david.nales...@gmail.com>:
>> >
>> >
>> > On Sun, Nov 22, 2015 at 1:21 PM, David Kastrup <d...@gnu.org> wrote:
>> >>
>> >>
>> >> > 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.
>> >>
>> >
>> > OK, I get it.  I need to override NoteHead.color with a procedure,
>> rather
>> > than the evaluation of the procedure.  (And a grob callback must of
>> course
>> > have a grob argument.  Passing my original as a procedure results in an
>> > error.)
>> >
>> > Thanks so much!
>> >
>> > David
>>
>>
>>
>> Though, why it is that arbitrary?
>>
>> Look at this variation and the attached image:
>>
>> \version "2.19.29"
>> #(define test-nmbrs
>>   (let ((nmbrs (circular-list 1 2 3 4)))
>>     (lambda (grob)
>>       (let ((n (car nmbrs)))
>>         (set! nmbrs (cdr nmbrs))
>>         (grob-interpret-markup grob (number->string n))))))
>>
>> {
>>   \repeat unfold 8 {
>>     \once \override TextScript.stencil = #test-nmbrs
>>     c''4^\markup "foo"
>>   }
>> }
>>
>>
>
Could they be processed out of left-to-right order?  Note that you get two
representatives of each number, and with \repeat unfold 80, you get 20 of
each.

DN
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to