lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Variables as variables


From: Josiah Boothby
Subject: Re: Variables as variables
Date: Mon, 20 Jan 2014 13:00:18 -0800

On Mon, 20 Jan 2014 16:00:59 +0100
Johan Vromans <address@hidden> wrote:

> Now I want to re-use bbb with a different value of aaa. Like a real
> variable as known from other programming languages.
> 
>   aaa = { c4 d e f }
>   bbb = { a4 a a a \aaa b4 b b b }
>   \score { \bbb }    % a4 a a a c4 d e f b4 b b b
>   aaa = { f4 e d c }
>   \score { \bbb }    % a4 a a a f4 e d c b4 b b b
> 
> Of course, this does not work. But I'm sure it can be made to work
> with some schemish tweaks beyond my current capabilities.

Would not a more canonical way be to use tags? Not as elegant maybe,
but:

aaa = { 
  \tag #'first { c4 d e f }
  \tag #'second { f4 e d c }
} 

bbb = { 
  a4 a a a 
  s4*4 
  b4 b b b 
}

\score { << \bbb { s4*4 \keepWithTag #'first \aaa } >> }

\score { << \bbb { s4*4 \keepWithTag #'second \aaa } >> }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]