emacs-devel
[Top][All Lists]
Advanced

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

Re: Additon to tumme.el


From: David Kastrup
Subject: Re: Additon to tumme.el
Date: Sun, 16 Jul 2006 14:35:56 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

"Mathias Dahl" <address@hidden> writes:

Just a code remark:

>    (mapc
>     (lambda (file)
>       (let* ((thumb-file (tumme-thumb-name file))
>              (img (create-image thumb-file))
>              comment-widget tag-widget)
>         (insert-image img)

[Kilometers of code...]

>     files))

I'd rather use

(let (thumb-file img comment-widget tag-widget)
   (dolist (file files)
      (setq thumb-file (tumme-thumb-name file)
            img (create-image thumb-file))
...

That is much more efficient (probably not a concern here) and also
much more readable, since the "files" does not crop up at some point
way down in the hierarchy.

The main point about efficiency is that (mapc (lambda...)) has to
create and destroy bindings for every single iteration.  Moving the
bindings of thumb-file etc out of the loop is also an efficiency
thing.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




reply via email to

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