lilypond-user
[Top][All Lists]
Advanced

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

Re: "inline" (scoped) definitions?


From: Paul Scott
Subject: Re: "inline" (scoped) definitions?
Date: Thu, 15 Jan 2004 09:48:05 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.5) Gecko/20031107 Debian/1.5-3

Kieren Richard MacMillan wrote:

Hello, Paul:

If I was not clear my question was what your idea had to do
with separating time information (in global) from the notes
in other sections. You didn't mention time signature in your hew example.


The mention of time signatures in my original post was just as one example of many possible applications, and how this technique might make file construction cleaner -- it would work just as well with pedal indication blocks, dynamic blocks, etc.


you could have

timeBlock = \notes
{
    {...} == timeVarOne
    {...} == timeVarTwo
    ...
    \timeVarTwo
    \timeVarOne
    ...
}

noteBlock = \notes
{
    {...} == noteVarOne
    \transpose c c' \noteVarOne
    ...
    {...} == noteVarTwo
    \transpose c c' \noteVarTwo
    ...
}


That is, the note variable definitions are inside the note block, and the time variable definitions are inside the time block.

Of course, you can (currently) simply stack them vertically, which would be an improvement over my first example:

timeVarOne = {...}
timeVarTwo = {...}
timeBlock = \notes
{
    ...
    \timeVarOne
    \timeVarTwo
    ...
    \timeVarTwo
    \timeVarOne
    ...
}

noteVarOne = {...}
noteVarTwo = {...}
noteBlock = \notes
{
    ...
    \noteVarOne
    \transpose c c' \noteVarOne
    ...
    \noteVarTwo
    \transpose c c' \noteVarTwo
    ...
}


However, in my opinion, that's still not as "clean" as what I'm proposing, since the first time you run into a definition (inside the main block), there is no indication nearby of what that definition actually comprises.

Did that example better answer your question?

Best regards,
Kieren.

p.s. I think I constructed this example so that simple variable combination and "\repeat unfold" will not suffice as a substitution -- however, if I didn't, there are certainly examples that could be...

I think as a programmer I agree with David that the macro/definitions are easier to find done the regular way. I sometimer end up with some pretty big notes sections even with all the shortcuts I take. I love the ability to define these macros in Lily and other text-based software.

Paul









reply via email to

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