Alec Bartsch <[email protected]> writes:

> On Sep 19, 2013, at 12:35 PM, David Kastrup <[email protected]> wrote:
>
>> 4 is a number.  You want (ly:make-duration 2 0) instead.
>
> OK, great, this version is going in my jazz \include and will tighten up my 
> code considerably:
>
> triplet = #(define-music-function (parser location tuplet-span music)
>                                                                 
> ((ly:duration? (ly:make-duration 2 0)) ly:music?)
>       #{
>               \tuplet 3/2 $tuplet-span { $music }
>       #})

When in doubt, you can always make do with the following:

triplet = #(define-music-function (parser location tuplet-span music)
 ((ly:duration?) ly:music?)
   (if tuplet-span
        #{
                \tuplet 3/2 $tuplet-span $music
        #}
        #{
                \tuplet 3/2 4 $music
        #}))

Just using the default #f for a defaulted value can save a lot of
thinking sometimes.

-- 
David Kastrup

_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to