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: Robin Bannister
Subject: Re: Making a list argument reliably optional
Date: Wed, 21 Aug 2019 22:37:21 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

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


Cheers,
Robin



reply via email to

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