lilypond-user
[Top][All Lists]
Advanced

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

Re: How do I mix ly and scheme in define-music-function


From: Maximilian Albert
Subject: Re: How do I mix ly and scheme in define-music-function
Date: Sun, 01 Apr 2007 15:06:12 +0200
User-agent: IceDove 1.5.0.10 (X11/20070307)

Nicolas Sceaux schrieb:

> Here is the structure of your function:
>
> setAltStaff =
> #(define-music-function (parser location style lowerOctave upperOctave)
>                       (string? number? number?)
>   (if #t
>       #{ ..foo.. #})
>   #{ ..baz.. #})
>
> The function return the last form, which is always #{ ..baz.. #}.
> You should write instead:
>
> setAltStaff =
> #(define-music-function (parser location style lowerOctave upperOctave)
>                       (string? number? number?)
>   (if condition
>       #{ ..foo.. #}
>       #{ ..baz.. #}))

But is that what Kevin wants to do? As far as I understood, he wants the
#{ ..baz.. #} part to be executed unconditionally. In your construct, it
acts as an _alternative_ to the #{ ..foo.. #} part. I must confess that
I only gave it a quick glance, but since the 'if' construct in his code
uses side-effects, it shouldn't matter what the function actually
returns. So it should work as intended. Or am I wrong?

Max





reply via email to

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