David Kastrup <d...@gnu.org> writes: > Thomas Morley <thomasmorle...@googlemail.com> writes: > >> Hi, >> >> I tried to create a function which should accept a pitch _or_ music. >> So I defined a pitch-or-music? predicate: >> >> #(define (pitch-or-music? x) >> (or (ly:pitch? x) (ly:music? x))) >> >> Calling the function, I have to use ##{ ... #} for music _and_ for a >> single pitch. > > For music it should work anyhow. The problem with pitch is that at the > current point of time, ly:pitch? and ly:duration? are specially detected > and specially treated, so even if you do > > #(define (mypitch? x) (ly:pitch? x)) > > it will not work. However, the predicate does not make all that much > sense since every pitch is also valid music. If we fastforward a few > months until pitch? is no longer special-cased,
More like a year. Issue 3618 <URL:http://code.google.com/p/lilypond/issues/detail?id=3618> > the parser will see the pitch, try passing it as a pitch to the > predicate and, since the predicate accepts, will _stick_ with this > choice. You could pass music by starting with { or so. Verified that this works, but you wrote Pitch-or-music once instead of pitch-or-music in your example. After lower-casing this, it appears to do the trick with the patch from the above issue applied. -- David Kastrup _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user