unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Philip Kaludercic <philipk@posteo.net>
Cc: Protesilaos Stavrou <info@protesilaos.com>,  emacs-devel@gnu.org
Subject: Re: [elpa] main 2ec80977e1: * elpa-packages (dired-preview): New package
Date: Thu, 13 Jul 2023 17:36:09 -0400	[thread overview]
Message-ID: <jwvv8enijmo.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87fs5rpnbv.fsf@posteo.net> (Philip Kaludercic's message of "Thu,  13 Jul 2023 20:29:24 +0000")

>> I believe I pushed all the relevant changes you suggested.  The only one
>> I have not done yet is the 'dolist' VS 'mapc' that you and Stefan
>> commented on.  I need to understand the technical differences better, so
>> as to know when to use 'mapc'.
>
> Do you have any concrete questions?  Semantically they should be
> equivalent, it is just a matter of estimating the cost of a funcall and
> of closures, which is why I suggest replacing (mapc (lambda (x) ... x
> ...) xs) with (dolist (x xs) ... x ...).

Actually, there are a few semantic differences:

- `mapc` also works on other sequences such as vectors and strings.
- `called-interactively-p` will always return nil when called from
  within the `mapc` (since it will say whether the function that makes
  up the loop body was called interactively rather than whether the
  surrounding function has been called interactively).
- similarly, other tools that look under the hood (like
  `backtrace-frames`) will give slightly different results.
- there might be further corner case differences e.g. if you modify the
  list while you iterate over it.


-- Stefan




  reply	other threads:[~2023-07-13 21:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <168884609732.27984.6450580686777461843@vcs2.savannah.gnu.org>
     [not found] ` <20230708195457.95F1AC11DD8@vcs2.savannah.gnu.org>
2023-07-08 21:47   ` [elpa] main 2ec80977e1: * elpa-packages (dired-preview): New package Stefan Monnier
2023-07-09  2:29     ` Protesilaos Stavrou
2023-07-10 18:29     ` Philip Kaludercic
2023-07-10 20:20       ` Protesilaos Stavrou
2023-07-10 21:13         ` Stefan Monnier
2023-07-11  7:47         ` Philip Kaludercic
2023-07-11 13:33           ` Stefan Monnier
2023-07-11 16:58             ` Philip Kaludercic
2023-07-11 18:45               ` Stefan Monnier
2023-07-13 18:40       ` Protesilaos Stavrou
2023-07-13 20:29         ` Philip Kaludercic
2023-07-13 21:36           ` Stefan Monnier [this message]
2023-07-14  8:13             ` Mattias Engdegård
2023-07-14 14:18               ` [External] : " Drew Adams
2023-07-14 19:29                 ` Philip Kaludercic
2023-07-18 19:06                   ` 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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=jwvv8enijmo.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=info@protesilaos.com \
    --cc=philipk@posteo.net \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).