David Nalesnik <david.nales...@gmail.com> writes:

> Hi,
>
> On Wed, Sep 23, 2015 at 7:35 AM, David Nalesnik <david.nales...@gmail.com>
> wrote:
>
>>
>>
>> On Wed, Sep 23, 2015 at 6:54 AM, David Kastrup <d...@gnu.org> wrote:
>>
>> the following open-coded loop is
>>> both opaque and inefficient (namely O(n^2) as _appending_ to a list is
>>> an O(n) operation):
>>>
>>>
>> OK, thanks!  Will update accordingly.
>>
>>
> I removed that idiom from the code, so it should be somewhat more efficient.

Well, the efficiency is not likely a concern for most use cases here.
But of course, once a text spanner like that is available, one can
indeed let it accompany a whole piece with hundreds or thousands of
elements.  And then it may become quite noticeable.

While O(n^2) code is sort of an automatic trigger for programmer
neuroses for me, I was more concerned about the readability.  Use of
"map" makes the relation between input and output more transparent.

-- 
David Kastrup

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to