lilypond-user
[Top][All Lists]
Advanced

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

Re: Iterating music for voiceOne. Checking with equal?


From: Thomas Morley
Subject: Re: Iterating music for voiceOne. Checking with equal?
Date: Fri, 27 Jul 2018 11:24:48 +0200

2018-07-26 17:33 GMT+02:00 David Kastrup <address@hidden>:
> David Kastrup <address@hidden> writes:
>
>> David Kastrup <address@hidden> writes:
>>
>>> Thomas Morley <address@hidden> writes:
>>>
>>>> Hi,
>>>>
>>>> I stumbled across
>>>> (equal?  #{ \voiceOne #} voiceOne)
>>>> returning false.
>>>>
>>>> Is it expected behaviour?
>>>
>>> equal? is not implemented all that great for "probs" but Music::equal_p
>>> is implemented in a manner where at least
>>>
>>> #(display (equal? voiceOne (ly:music-deep-copy voiceOne)))
>>>
>>> would be expected to display #t and it doesn't.
>>>
>>> Sigh.  I'll see what I can find out.
>>
>> Tracker issue: 5391 (https://sourceforge.net/p/testlilyissues/issues/5391/)
>> Rietveld issue: 363740043 (https://codereview.appspot.com/363740043)
>> Issue description:
>>   Prob::equal_p: discard "origin" property  Previously elements of
>>   class Input was considered equal when compared as part of Music
>>   property lists but this did not take into account that some music
>>   might store its origin (if any) at different locations in its
>>   property lists.  So we just discard any "origin" property
>>   completely, regardless of position in the property list and its
>>   actual value type.   Also contains commit:  Don't set origin on
>>   copied music explicitly  There would be some mild incentive if the
>>   origin were accessed an inordinary amount of times (and thus leaving
>>   it unset would maximize access times to it) but there is no evidence
>>   for that.  One reason might be to ensure greater structural
>>   similarity between copies of music, but Prob::equal_p has been
>>   changed to be robust against differences here.

I've applied your patch and tested with:

#(define tst-ls
  (list
    voiceOne
    #{ \voiceOne #}
    (ly:parser-lookup 'voiceOne)
    (ly:music-deep-copy voiceOne)
    (ly:music-deep-copy #{ \voiceOne #})
    (ly:music-deep-copy (ly:parser-lookup 'voiceOne))))

#(format #t "\ncleaned-list-length: ~a\n"
  (length (delete-duplicates tst-ls equal?)))

=>
cleaned-list-length: 1

as desired.

>
> In the mean time, here is a workaround:
>
> voiceOne = \voiceOne

With this workaround, "cleaned-list-length" is 1 for 2.19.82 as well.
>
> Seriously.
:)


Many thanks working on it,
  Harm



reply via email to

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