[Top][All Lists]

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

Re: [elpa] main 2ec80977e1: * elpa-packages (dired-preview): New package

From: Stefan Monnier
Subject: Re: [elpa] main 2ec80977e1: * elpa-packages (dired-preview): New package
Date: Thu, 13 Jul 2023 17:36:09 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

>> 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 via email to

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