Maximilian Albert <[EMAIL PROTECTED]> writes:
> 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.
Ok, I misunderstood.
The music expression that is finally inserted into the surrounding music
is what is *returned* by the music function, that is, the last form. So
the #{..foo..#} has to be conditionaly inserted in the last form,
otherwise it is lost in the void.
setAltStaff =
#(define-music-function (parser location ...)
(...)
(make-music 'SequentialMusic
'elements (list (if ..condition..
#{ ..foo.. #}
;; if condition is not fulfilled, empty music:
(make-music 'SequentialMusic))
#{ ..baz.. #})))
nicolas
_______________________________________________
lilypond-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-user