lilypond-user
[Top][All Lists]
Advanced

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

Re: Workaround for (not-allowed) numbers in variable names?


From: Peter Toye
Subject: Re: Workaround for (not-allowed) numbers in variable names?
Date: Sun, 7 Mar 2021 11:42:30 +0000

I asked this question some time ago, and David Kastrup was kind enough to put me right.

The problem , as you mentioned, is in the way that numbers are used for durations. Consider the following code:

chord = <c e g>
chord2= <d f a>

c1 \chord2

Should the second element be interpreted as
<c e g>2 or <d f a>1? I imagine this would confuse the lexer horribly. No doubt some rules could be written to resolve this, but it would need some recoding. Easier to stick with using quotes.

Best regards,

Peter
mailto:lilypond@ptoye.com
www.ptoye.com

-------------------------

> Message: 2
> Date: Fri, 5 Mar 2021 18:17:02 +0100
> From: Silvain Dupertuis <
silvain-dupertuis@bluewin.ch>
> To:
lilypond-user@gnu.org
> Subject: Re: Workaround for (not-allowed) numbers in variable names?
> Message-ID: <
b9dbb20f-1070-583f-35ee-facd36b0b4ce@bluewin.ch">b9dbb20f-1070-583f-35ee-facd36b0b4ce@bluewin.ch>
> Content-Type: text/plain; charset="utf-8"; Format="flowed"

> I also wondered why numbers are not allowed in variables.
> As for me, I used things like A, B, C instead... but it is less practical.

> My guess is that it may be linked to the way numbers are used in notes and chords to
> indicate duration, otherwise it would be real nice to be able to use digits in variable
> names...!

> Le 05.03.21 à 17:37, stefano franchi a écrit :
>> Here is a question for anyone who may have been using lilypond for projects involving
>> text and many, many, short and similar musical snippets.

>> I am putting together a book that will contain many (very brief)  exercises, grouped
>> thematically. I had thought a convenient and flexible way to organize the material and
>> keep future maintenance under control would be to create top level variables names for
>> the main musical categories and sub-categories and then assign each score snippet to
>> progressively numbered variable. So I would have, CategA-1 = {"code for one exercise"} ,
>> CategB-2 = "code for another exercise"}, and so on. Clean structure, easy to maintain
>> and rearrange, etc.

>> Then I discovered that lilypond does not allow numbers in variable names.... :-(

>> I'd be willing to bet my use case is not particularly weird---there must have been other
>> people encountering the same problem.

>> How have you guys managed it?

>> Cheers,

>> S.


>> --
>> __________________________________________________
>> Stefano Franchi

>> stefano.franchi@gmail.com <mailto:stefano@tamu.edu>
>> /https://www.researchgate.net/profile/Stefano_Franchi/
>> <
https://www.researchgate.net/profile/Stefano_Franchi>


> --
> Silvain Dupertuis
> Route de Lausanne 335
> 1293 Bellevue (Switzerland)
> tél. +41-(0)22-774.20.67
> portable +41-(0)79-604.87.52
> web: silvain-dupertuis.org <
http://perso.silvain-dupertuis.org>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
https://lists.gnu.org/archive/html/lilypond-user/attachments/20210305/88659feb/attachment.html>

> ------------------------------

reply via email to

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