David Kastrup wrote:
A number list counts as not-number?.
So I changed the not- number? predicate to also exclude number-list? but
this was no better. And then I determined all the individually
problematic lilypond-scheme-predicates and also excluded these in the
predicate never-matches-a-number? - which nevertheless matched a number.
That was when I gave up fighting the automagic.
> So if you are out for a more specific type of list before a number,
> you should check for that.
I was using what might be described as a sparse ordered list, basically
markup-list? but having its gaps filled with rogue elements, for which I
used a (non-markup) asterisk.
Following your advice, I got this working in stellated_ok.ly.
But this seemed overly complicated:
- the predicate definition had to be separate (AFAICS)
- the list had to be set up in Scheme.
That was when I decided to embrace automagic.
The rogue elements are now markup too, matched with the help of
markup->string:
- the predicate is just markup-list?
- the list can be set up with \markuplist.
The in-band key is unlikely to be a problem.
Thanks for your help.
Cheers,
Robin
% versions 2.18.2 through 2.19.83 ok
#(define (*-markup-list? x)
(and (list? x) (markup-list? (remove (lambda(y) (equal? * y)) x))))
listnumber =
#(define-music-function (parser location listarg numberarg)
((*-markup-list? '()) number?)
(let ((str (number->string numberarg)))
#{
c''1-\markup $str
#}))
{
s1_"markup-list? excludes numberarg's 333: so does a stellated hybrid:"
\break
s1_"\listnumber #'() 333" \listnumber #'() 333 s1 % explicitly empty ok
\break
s1_"list has markups" \listnumber #(list "44" "*" "66" ) 333 s1 % markup ok
\break
s1_"list has * too" \listnumber #(list "44" * "66" ) 333 s1 % stellated ok
\break
s1_"list has only * " \listnumber #(list * * * ) 333 s1 % all-star ok
\break
s1_"\listnumber 333" \listnumber 333 s1 % omitted ok
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user