lilypond-user
[Top][All Lists]
Advanced

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

Re: variables in \book { }


From: Jan-Peter Voigt
Subject: Re: variables in \book { }
Date: Wed, 17 Feb 2016 11:03:14 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1

... better to use define-void-function

%%% snip %%%
pdefine = #(define-void-function (sym val)(symbol? scheme?)
(ly:parser-define! sym val))
%%% snip %%%

Cheers
Jan-Peter

Am 17.02.2016 um 10:56 schrieb Jan-Peter Voigt:
> Hi Graham,
> 
> I didn't went through the whole thread, but IIUC, the problem is about
> defining variables inside a pair of braces. Sometimes I use a helper
> function to define variables:
> 
> %%% snip %%%
> \version "2.19.35"
> 
> % a little helper function using ly:parser-define!
> pdefine = #(define-scheme-function (sym val)(symbol? scheme?)
> (ly:parser-define! sym val))
> 
> \book {
> % define "music"
>   \pdefine music \relative { c' d e f }
>   \score {
>     \music
>   }
> }
> %%% snip %%%
> of course, you might also just write
> $(ly:parser-define! 'music #{ \relative { c' d e f } #})
> without defining "pdefine" (or whatever you like to name it, but avoid
> "define" ;) )
> 
> HTH
> Jan-Peter




reply via email to

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