emacs-lisp-style-guide icon indicating copy to clipboard operation
emacs-lisp-style-guide copied to clipboard

Consistency between seq-do, seq-map, mapc, and mapcar

Open hlissner opened this issue 5 years ago • 1 comments

Use seq-do or dolist instead of mapcar if you don’t intend to concatenate the result.

Hi! I'm curious about the wording of this guideline. Suggesting dolist makes sense to me, but:

  1. Why seq-do over mapc? seq isn't immediately available without loading seq, but mapc is.

  2. If it's because seq-do is more generic, why offer mapcar as an alternative instead of the similarly generic seq-map?

Thanks for your time!

hlissner avatar Apr 10 '20 04:04 hlissner

Why seq-do over mapc? seq isn't immediately available without loading seq, but mapc is.

It makes sense if you're already using seq.el for consistency's sake. I guess we can improve the wording there. Many guidelines can benefit from this. :-)

bbatsov avatar Apr 26 '20 07:04 bbatsov