[Top][All Lists]

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

Re: [PATCH] What's the quickest way to contribute?

From: Stefan Monnier
Subject: Re: [PATCH] What's the quickest way to contribute?
Date: Tue, 13 Jan 2015 00:10:01 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

>> Finally, I attach one more patch that I'd like some feedback on.
>> I was browsing replace.el and found this type of code:
>> (delq nil (mapcar #'(lambda (buf)
>>                       (when (buffer-live-p buf) buf))
>>                   bufs))
>> instead of this:
>> (cl-remove-if-not #'buffer-live-p bufs)
>> If this were my package, I would change it without batting an eye,
>> since the latter code is more clear and algorithmically faster.

I think algorithmically, it's equivalent (both are O(N), basically).
I wouldn't be able to predict which one will be faster, but my guess is
that it'll be a wash (and I'd expect the `delq' loop to be negligible
compared to the `mapcar' loop).

So the clarity aspect is the more important argument.

> Using `cl-' functions is allowed, but I guess there remains some amount of
> prejudice against the CL coding style, and using those (more complicated)
> functions when simpler ones can work just as well.

Yes, cl-* functions are definitely allowed.  There is of course a lot of
carried prejudice from when cl-* functions didn't exist (and we just
had the `remove-if-not' instead, whose use was not accepted in Emacs's
own code), but there is also still a restriction in this respect: cl-*
functions still can't be used from preloaded files (because that would
require preloading cl-lib).


reply via email to

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