lilypond-devel
[Top][All Lists]
Advanced

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

Re: Clean up code for sorting grob-properties. (issue 102760044)


From: dak
Subject: Re: Clean up code for sorting grob-properties. (issue 102760044)
Date: Thu, 29 May 2014 06:01:42 +0000

On 2014/05/28 22:01:20, Mark Polesky wrote:
On 2014/05/28 21:46:55, dak wrote:
> Doing an assoc-set! here is inefficient inside of the loop.  Instead
of
> (for-each
>    (lambda (grob-description)
>       ...
>       (set! all-grob-descriptions (assoc-set! ...
>
> one should use
> (set! all-grob-descriptions
>   (map!
>      (lambda (grob-description)
>         ;replacement for grob description)
>      all-grob-descriptions))

Like this?

Yup, looks good.  Of course, it wasn't your fault in the first place,
but it would be strange not to use an opportunity for cleaning this up.
Actually thinking about it, map! isn't the hottest idea since it
modifies a constant in the code (undefined behavior, might be flagged at
one point of time).  But so do all of the assoc-set! calls: this would
have to be rewritten as a whole, and while this is not done, one might
as well use map! here.

https://codereview.appspot.com/102760044/



reply via email to

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