lilypond-user
[Top][All Lists]
Advanced

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

Re: Programmatically building music-function names


From: David Kastrup
Subject: Re: Programmatically building music-function names
Date: Fri, 15 Jan 2016 18:26:20 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Chris Yate <address@hidden> writes:

> Hi,
>
> I'm trying to typeset a number of short pieces into multiple scores in one
> file. I can do this manually, as:


> This doesn't work; my substitution syntax is clearly wrong here, but
> I'd be interested to see if there's a way to do it.  Or does the way
> the code is parsed mean music functions can't be referenced in this
> way?

A score is not music.

And you cannot splice identifiers like

    \music#number

That's just nonsensical.  Try something like

\version "2.19.35"

musicOne = \relative c'' { g4 a b c }
musicTwo = \relative c'' { g4 a b c }

% Manually create all scores

\score {  
 \musicOne
}

\score { 
  \musicTwo
}

% Programmatically create scores?

printTheScore = 
#(define-scheme-function (number) (string?)
#{     
\score {
  $(module-ref (current-module)
    (string->symbol (format "music~a" number)))
}
#})

\printTheScore "One"
\printTheScore "Two"

-- 
David Kastrup

reply via email to

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