[Top][All Lists]

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

Re: need for 'dynamical-let'?

From: Stefan Monnier
Subject: Re: need for 'dynamical-let'?
Date: Fri, 24 Jul 2015 19:32:58 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

> (let (branch-list
>       ...)
>    (add-to-list 'branch-list (substring branch-entry 2) t)

This is butt-ugly and ridiculously inefficient.
In such code, don't use add-to-list (which is OK for configuring
global vars, but not for such situations) and don't use the t argument
which makes the operation O(N).
As Dmitry says, using `push' or `cl-pushnew', and if need the object in
some other order, re-order them later, e.g. with nreverse.


reply via email to

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