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

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

Re: quickly find all executables


From: Kin Cho
Subject: Re: quickly find all executables
Date: 25 Jul 2003 10:17:33 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Eric Marsden <emarsden@laas.fr> writes:

>   (remove-if-not 'file-executable-p
>      (mapcan (lambda (dir) (directory-files dir t))
>              (remove-if-not 'file-directory-p exec-path)))

Thanks.  This code is significantly shorter than Kevin Rodgers'
version, and it runs in virtually the same amount of time for my
setup (ok, about .02 seconds slower to be exact).

This is quite amazing to me -- I thought lambda's are function
calls, and function calls are slow, at least on a CISC CPU like
the P4 that I'm running on.

I changed the predicate to this so it won't return directories in
the output.

(lambda (f) (and (file-executable-p f) (file-regular-p f)))

-kin


reply via email to

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