all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: Oleh Krehel <o.krehel@tue.nl>, emacs-devel@gnu.org
Subject: Re: [PATCH] What's the quickest way to contribute?
Date: Tue, 13 Jan 2015 00:10:01 -0500	[thread overview]
Message-ID: <jwvbnm31dd4.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <54B4899B.8010004@yandex.ru> (Dmitry Gutov's message of "Tue, 13 Jan 2015 05:57:31 +0300")

>> 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).


        Stefan



  reply	other threads:[~2015-01-13  5:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-08 17:59 [PATCH] What's the quickest way to contribute? Oleh Krehel
2015-01-08 18:48 ` Eli Zaretskii
2015-01-08 19:04   ` Samer Masterson
2015-01-08 19:13     ` Dmitry Gutov
2015-01-09  0:01     ` Richard Stallman
2015-01-13  2:57 ` Dmitry Gutov
2015-01-13  5:10   ` Stefan Monnier [this message]
2015-01-13 11:15     ` Dmitry Gutov
2015-01-13 19:24       ` Stefan Monnier
2015-01-13 13:46     ` Oleh Krehel
2015-01-13 19:32       ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvbnm31dd4.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --cc=o.krehel@tue.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.