lilypond-user
[Top][All Lists]
Advanced

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

Re: Music-function "arguments" - help


From: David Kastrup
Subject: Re: Music-function "arguments" - help
Date: Fri, 07 Dec 2018 13:01:56 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Urs Liska <address@hidden> writes:

> Am 07.12.18 um 10:55 schrieb mansouraoun:
>> i wrote the code in raw and it's somehow not displayed in my message
>> Here it is
>>
>> dynx =
>> #(define-music-function
>>       (parser location X-offset)
>>       (number?)
>>     #{
>>       \once\override DynamicText.X-offset = #X-offset
>>     #})
>>
>> Mansour
>>
> As David said: if you use the development version (currently 2.19.82)
> you can simplify this by skipping "parser location":
>
>   ...
>   #(define-music-function (X-offset)(number?)
>   ...

Actually, if you switch to the development version, you can simplify
this by writing

dynx = \once\override DynamicText.X-offset = \etc

but the \etc construct works only for a limited number of uses and does
nothing different than generating a music function of that kind.  Also
when writing the music function manually, you can use a more specific
predicate and have the arguments checked directly for the right type and
possibly coerced: for example, -3 without further qualification is a
number, but when you use a ly:event? predicate for a music function, it
will be a fingering.

-- 
David Kastrup



reply via email to

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