lilypond-user
[Top][All Lists]
Advanced

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

Re: recursive music function definitions broken in 2.14 ?


From: Juha Erkkila
Subject: Re: recursive music function definitions broken in 2.14 ?
Date: Tue, 4 Oct 2011 12:27:32 +0300
User-agent: Mutt/1.4.2.3i

On Mon, Oct 03, 2011 at 02:41:13PM +0200, David Kastrup wrote:
> Juha Erkkila <address@hidden> writes:
> > I had some lilypond code that worked in 2.12 versions, but appears
> > broken in 2.14.  I had used a construction in which a music function
> > calls itself.  Here's an example:
> >
> > ----------------------------------------------------------------------
> > tags = #(define-music-function (parser location tags music)
> >                                (list? ly:music?)
> >          (cond ((null? tags) music)
> >                (else (let ((firsttag  (car tags))
> >                            (othertags (cdr tags)))
> >                       #{ \tags $othertags \tag $firsttag $music #}))))
> >
> > foo = \tag #'a \tag #'b { c4 d e f } 
> > bar = \tags #'(a b) { c4 d e f }
> >
> > \score {
> >   {
> >     \keepWithTag #'a \foo
> >     \keepWithTag #'b \foo
> >
> >     \keepWithTag #'a \bar
> >     \keepWithTag #'b \bar
> >   }
> > }
> > ----------------------------------------------------------------------
> 
> The problem here is that you are writing $othertags.  This tells
> Lilypond that it should figure out on its own what syntactic type
> $othertags should receive.  An empty list meets the markup-list?
> predicate, so Lilypond decides to consider this a markup list
> syntactically.  Which is not compatible with the list? predicate, since
> that is looking for a Scheme expression (or a simple string)
> syntactically.
> 
> So just writing #$othertags should put Lilypond on the right track and
> keep it from guessing the syntactical class wrong here.

Ah, that explains it.  Thank you, your solution works.
 
Juha



reply via email to

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