lilypond-user
[Top][All Lists]
Advanced

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

Re: predicate pitch-or-music? - getting rid of ##{ #} ?


From: Janek Warchoł
Subject: Re: predicate pitch-or-music? - getting rid of ##{ #} ?
Date: Thu, 17 Oct 2013 19:57:44 +0200

2013/10/17 David Kastrup <address@hidden>:
> David Kastrup <address@hidden> writes:
>
>> Thomas Morley <address@hidden> 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.

thank you!



reply via email to

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