lilypond-user
[Top][All Lists]
Advanced

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

Re: scheme documentation and optional arguments


From: Nicolas Sceaux
Subject: Re: scheme documentation and optional arguments
Date: Sat, 31 Mar 2007 12:12:06 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin)

Paul Scott <address@hidden> writes:

> Nicolas created the following for me some time ago and it works:
>
> #(define* (textPad padding #:optional once?)
>   (ly:export   ; this is necessary for using the expression
>    ; directly inside a block
>    (if once?
>     #{ \once \override TextScript #'padding = #$padding #}
>     #{ \override TextScript #'padding = #$padding #})))
>
>
> The newer documentation on music functions 12.1 uses
> define-music-function instead of define*  Where can I find documentation
> to make the #:optional once? part above work with define-music-function
> so I can write some more functions that I want?

There is not such thing as optional argument in music functions.
You may do instead:

textPadding =
#(define-music-function (parser location padding) (number?)
   #{ \override TextScript #'padding = #$padding #})

textPaddingOnce =
#(define-music-function (parser location padding) (number?)
   #{ \once \override TextScript #'padding = #$padding #})

\textPadding #3
===
\override TextScript #'padding = #3

\textPaddingOnce #3
===
\once \override TextScript #'padding = #3

nicolas




reply via email to

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