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/

_______________________________________________
lilypond-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to