Hi all, I would like to have two optional arguments in a music function. My current approach fails, and I don't know if I'm doing anything wrong or if I'm trying the wrong thing in the first place.
I have created an interface with two optional and one mandatory argument. I thought that this should work as long as they differ in type. However, it only works properly when both arguments are missing or if the second arg is missing (and of course if all are provided). However, when the first one is missing the function raises a syntax error. Is this because LilyPond can't properly discern the two types or is it generally impossible to use two such optional arguments in sequence? And if the latter, how can I achieve the effect otherwise? What I want is that the function uses a global variable but sets it to a new value before in the case one is provided by the user. Thanks Urs %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \version "2.19.50" test = #(define-void-function (fund dur ratio) ((ly:pitch?) (ly:duration?) fraction?) (if (ly:pitch? fund) (format "Pitch found: ~a" fund)) (display fund)(newline) (display dur)(newline) (display ratio)(newline)) % regular invocation \test b, 4 3/2 % both optional args missing (works) \test 4/3 % second optional arg missing (works) \test b, 5/4 % first optional arg missing (syntax error: unexpected FRACTION) \test 2 6/5 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user