[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: predicate pitch-or-music? - getting rid of ##{ #} ?
From: |
David Kastrup |
Subject: |
Re: predicate pitch-or-music? - getting rid of ##{ #} ? |
Date: |
Thu, 17 Oct 2013 11:48:08 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
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.
--
David Kastrup
- Re: predicate pitch-or-music? - getting rid of ##{ #} ?,
David Kastrup <=