lilypond-user
[Top][All Lists]
Advanced

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

Re: tiny function


From: David Kastrup
Subject: Re: tiny function
Date: Fri, 01 Jul 2016 00:12:36 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

"Br. Gabriel-Marie | SSPX" <address@hidden> writes:

> In my music script I want to use this:
>
> \new Lyrics \with { instrumentName = "1." shortInstrumentName = "1." }
>
> However, I would like to make a function out of it.  I'm looking at
> this page:
> http://lilypond.org/doc/v2.18/Documentation/learning/saving-typing-with-variables-and-functions
>
> and this is what I have come up with, but I know this isn't right. Can
> someone correct this for me?
> Basically, I want to do this:
> \new Lyrics \verseNumber #1
>
> and have it create this:
> \new Lyrics \with { instrumentName = "1." shortInstrumentName = "1." }
>
> verseNumber = #(define-music-function(parser location whatnumber)(
> number?) #{  \with { instrumentName = #whatnumber "."
> shortInstrumentName = #whatnumber "." } #}

You need define-scheme-function here, and you cannot just put numbers
and strings next to each other and hope that LilyPond will somehow make
a string from that.  You could try #(format "~a." whatnumber) here.

-- 
David Kastrup



reply via email to

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