[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug-lilypond Digest, Vol 95, Issue 21
From: |
Roman Stawski |
Subject: |
Re: bug-lilypond Digest, Vol 95, Issue 21 |
Date: |
Sat, 09 Oct 2010 08:24:59 +0200 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.9) Gecko/20100915 Lightning/1.0b2 Thunderbird/3.1.4 |
On 08/10/2010 23:24, Carl Sorensen wrote:
>
> My version:
>
> \version "2.13.34"
>
> %% This scheme expression is evaluated during parsing; it creates a variable
> %% sequence-number with the value of 0
> #(define sequence-number 0)
>
> %% This is evaluated during parsing; it creates a markup function with one
> %% argument
> #(define-markup-command (score-sequence layout props sequence-number)
> (number?)
> (interpret-markup layout props
> (markup #:bold #:large (number->string sequence-number))))
>
> \new Staff {
> %% This is evaluated during parsing; it adds 1 to the value of
> %% sequence-number
> #(set! sequence-number (1+ sequence-number))
>
> %% This is evaluated during parsing; it puts a markup function on the
> %% music tree, along with its argument, which is the current value
> %% of sequence-number during the parsing stage.
> \set Staff.instrumentName = \markup\score-sequence #sequence-number
>
> %% This is evaluated during parsing. It puts the markup function on
> %% the music tree, along with the current value of sequence-number
> a'1^\markup\score-sequence #sequence-number
> }
>
> \new Staff {
> %% sequence-number is incremented during parsing
> #(set! sequence-number (1+ sequence-number))
>
> %% the current value of sequence-number is stored in the music tree as
> %% an argument to the markup function (both calls)
> \set Staff.instrumentName = \markup\score-sequence #sequence-number
> b'1^\markup\score-sequence #sequence-number
> }
>
> \new Staff {
> %% sequence number is incremented
> #(set! sequence-number (1+ sequence-number))
>
> %% The new value of sequence number is stored in the music tree.
> \set Staff.instrumentName = \markup\score-sequence #sequence-number
> c''1^\markup\score-sequence #sequence-number
> }
>
> The general rule: if it's preceded by #, it's evaluated by the scheme
> interpreter during the parsing stage. If it's not preceded by #, it will be
> evaluated during the translation stage. (Although I won't promise this rule
> *always* holds).
Right, I understand now what you're saying. I find that it's a little
bit more messy that what I tried to do but it does have the great
advantage that *it works* (which is more than can be said for my effort!).
I appreciate the time you spent in annotating the two techniques.
Thanks again
Roman