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 22:54:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Robin Bannister <address@hidden> writes:

> David Kastrup wrote:
>
>> 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
>> allow something like a single-element string list. 
>
> Well no, the \liststring calls were to make a vividly correct contrast!
> My case is like the \listnumber 333 call.
>
> I can't imagine how list? could accept the number 333,
> or why some putative automagic would want it to.
> And if I use a more specific predicate and it solves the 2.19.39
> problem, how can I know if it is going to stay solved?
>
>
> I tried the following (which is probably nonsense):
>
> %%%%%%%%
>
> #(define (notnumber? x)
>   (not (number? x)))
>
> listnumber =
> #(define-music-function (parser location listarg numberarg)
>   ((notnumber? '()) number?)
>   (let ((str (number->string numberarg)))
>     #{
>       c''1-\markup $str
>     #}))
>
> %%%%%%%%
>
> and it still says:   error: wrong type for argument 2.  Expecting number

It doesn't say anything like that since it doesn't even call
listnumber.  And your other example is a complex mixture of listnumber
and liststring.  Could you please post an actual minimal example we
could talk about usefully?

-- 
David Kastrup



reply via email to

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