Thank you! I see that this is not an option then. Also, I now understand why I couldn't make the optional arguments work, since I always left them for last.
Do you know if it is possible to have a flexible amount of optional arguments that appear before the last mandatory one? Say, for example (define-music-function (arg1 args music) (number? ??? ly:music?) where arg1 and music are mandatory, and basically everything between arg1 and the next music expression is compacted into a list and accessed as args in the body of the function. Not with that syntax necessarily, but something that allows for that kind of usage? 2018-02-28 20:45 GMT-03:00 Simon Albrecht <simon.albre...@mail.de>: > On 28.02.2018 23:54, Stefano Troncaro wrote: > >> I need a little help again. I'm struggling to understand how one would >> make a music function like \tempo, that accepts a variable number of >> arguments. I couldn't find its definition so I couldn't look for myself. >> >> So far I know about making lambdas that take additional arguments and >> store the extras in a list, but this does not work in a music function (or >> if it works I don't know how to do it). And while I could make a lambda >> that then passes the arguments to a music function, then I can't use it >> with Lilypond syntax, so I'm forced to put the lambda and all it's >> arguments between parenthesis. >> >> But \tempo doesn't require parenthesis, and the parser still understands >> what is part of the function and what not. How would one go about writing a >> function that behaves like this? >> > > As has been said, \tempo isn’t a music function. However, you _can_ define > functions with optional arguments; it’s mentioned in < > http://lilypond.org/doc/v2.19/Documentation/extending/schem > e-function-definitions>. The last optional argument has to be followed by > a mandatory argument of different type, because that’s how the parser will > recognise that optional arguments were skipped. > > HTH, Simon >
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user