|more useful options|
Re: mapcar -- map for more than one listby mugwumpjism (Hermit)
|on Dec 01, 2001 at 00:50 UTC||Need Help??|
I'm not sure this is right.
The e-LISP mapcar, according to the info page "(elisp) Mapping Functions", is defined as follows:
- Function: mapcar FUNCTION SEQUENCE `mapcar' applies FUNCTION to each element of SEQUENCE in turn, and returns a list of the results. The argument SEQUENCE can be any kind of sequence except a char-table; that is, a list, a vector, a bool-vector, or a string. The result is always a list. The length of the result is the same as the length of SEQUENCE.
IANALH, but that sounds remarkably like Perl's map function.
However, it does go on to provide an example which seems to do (almost) the same thing that your mapcar does:
Besides that, "car" is an old term coming from the term "Contents of the Address part of the Register". I don't know where you got mapcaru from.
Perhaps this is a common lisp vs e-lisp thing, as I found at least one page that makes reference to mapcar behaving in the way you specify.
I suggest the name mapshift instead of mapcar, for the version that returns short lists. The other one should perhaps be called something else, like mapfor or mapforeach perhaps.
Here is a new one, too - mapeach, which works on hash refs passed to it: