lilypond-user
[Top][All Lists]
Advanced

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

Re: Call a score variable by a scheme expression


From: David Kastrup
Subject: Re: Call a score variable by a scheme expression
Date: Thu, 27 Dec 2012 18:55:22 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Marc Hohl <address@hidden> writes:

> Hello list,
>
> I think this has been answered before, but I don't find it in the
> archives...
>
> Assume I have the following file scoretest.ly:
>
> \version "2.17.10"
>
> #(define opt-score (or (ly:get-option 'score) "Full"))
>
> musicA = \relative f {
>   c''4 d e f | g1
> }
>
> musicB = \relative f {
>   c'4 b a f | g 2 g
> }
>
> testScoreA = \score {
>   \new Staff { \musicA }
> }
>
> testScoreB = \score {
>   \new Staff { \musicB }
> }
>
> testScoreFull = \score {
>   <<
>     \new Staff { \musicA }
>     \new Staff { \musicB }
>   >>
> }
>
> \score {
>   #(string-append "testScore" opt-score)
> }
>
> I want to call this file either by lilypond without options,
> which should yield in calling \testScoreFull in the \score { ... },
> or by 'lilypond -dscore="A" testscore.ly' to obtain \score { \testScoreA },
> 'lilypond -dscore="B" testscore.ly' should produce \score { \testScoreB }.
>
> The test file does not work, and I am sure that I have seen
> something very similar somemonths ago, but I don't find it right now.
>
> Any hints are highly welcome!

#(string-append ...) is a string.

Maybe you want something like

$(module-ref (current-module) (string->symbol ...))

or

$(ly:parser-lookup parser (string->symbol ...))

Not particularly fond of this kind of interface, though.

-- 
David Kastrup




reply via email to

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