help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: cl-dolist, dolist, cl-return,


From: Stefan Monnier
Subject: Re: cl-dolist, dolist, cl-return,
Date: Wed, 08 Jul 2015 10:44:13 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

>> Right, the question often makes sense for loop boundary computations,
>> but for this specific case, if you think enough about it, it makes no
>> sense to re-evaluate it: you'd have to use an index into the list,
>> and at each iteration, increment the index, recompute the list, and
>> do an (nth <index> <list>), which would overall be
>> *really* inefficient.
> No, of course I don't want to re-evaluate it! I didn't

My point was that the re-evaluation part would be just a side-problem:
even if your expression is a mere variable (so re-evaluating it is very
cheap), the need to use `nth' at each step would force an O(N^2)
complexity to this loop.


        Stefan




reply via email to

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