lilypond-devel
[Top][All Lists]
Advanced

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

Re: Simplification of live-elements-list, why not?


From: Boris Shingarov
Subject: Re: Simplification of live-elements-list, why not?
Date: Mon, 15 Nov 2010 02:07:29 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100922 Thunderbird/3.1.4

On 10-11-14 11:59 PM, Joe Neeman wrote:
Any specific reason why not just filter on the is-live? predicate?


Doesn't filter just work on plain scheme lists? elements is a grob-array object. Of course, if filter doesn't work on such objects it might be better to write a version of filter rather than replicating it many times.

filter works on things that understand car and cdr; which elements clearly doesn't, because it's just a "boxing" wrapper around Grob_array*.  What I am doing is go to a list first, and then filtering:

(define (live-elements-list me)
  (filter grob::is-live? (grob-array->list (ly:grob-object me 'elements))))


where grob-array->list is a function which I just made.

The reason I am asking, is because even after spending 10 minutes looking at the procedural-style code in the current live-elements-list, I am still not sure what the answer is to the question, "what does this function do?"  Does it just filter the elements according to grob::is-live??  Or does it do something more / less / different?  Quite seriously, it's just hard to be sure.

reply via email to

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