bbatsov / emacs-lisp-style-guide

A community-driven Emacs Lisp style guide
1.08k stars 53 forks source link

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

Open hlissner opened 4 years ago

hlissner commented 4 years ago

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!

bbatsov commented 4 years ago

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