lilypond-user
[Top][All Lists]
Advanced

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

Re: Making a list argument reliably optional


From: David Kastrup
Subject: Re: Making a list argument reliably optional
Date: Wed, 21 Aug 2019 18:56:18 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Robin Bannister <address@hidden> writes:

> Hallo all
>
> I'm having unexpected problems with a music function.
> It takes several arguments, the first of which expects a list,
> and should be optional.
>
> Today it tripped up when run with a late 2.19 version and I narrowed
> this down to 2.19.39. It seemed to have trouble with the second
> parameter so I set up test cases where this varied, expecting a
> mixture of good and bad.  But instead I got a confusing mixture of bad
> and bad, including a 2.18.2 failure.  See listargtest.ly.
>
>
> The music function chordRepeats has a similar first argument for
> event-types but that hasn't helped me see what I am doing wrong.
> I suppose it's me or my computer that's wonky, so I would be glad of
> a fresh eye or a second opinion.

A list? predicate for an optional argument is very iffy since there is a
whole lot of input that can be made to match this predicate.

For example, "bla" is a string list with a single element if it cannot
be matched otherwise.

It works more or less when the next argument is music (though in
\lyricmode this is an entirely different can of worms).

So your examples are much too generic to give advice.  It's likely that
you can solve your problem by using a much more specific predicate than
list? unless the form of list that you want to admit really needs to
allowq something like a single-element string list.  Maybe you need to
rethink your interface then.

-- 
David Kastrup



reply via email to

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