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

Using macros in Mapping functions



  I just finished reading Ken Pitman's Lisp Conference article on
macros and Fexpr's in which he points out that a difference between
macros and Fexpr's is that you can apply Fexpr's, which you cannot do
so with macros.  This is indeed a significant point.  I have been
irritated for a long time by having to write forms like the following

  (MAPCAR #'(LAMBDA (X) (SECOND X)) L)

when I would much rather write

  (MAPCAR #'SECOND L)

I would like to ask now why the second form above cannot be taken as
a shorthand for the first (using a gensym for the variables)?
It seems unreasonable to force the user to write the first form
or, even worse,

  (MAPCAR #'CADR L)

if the interpreter and compiler could systematically accept the
shorter form as a valid abbreviation for the longer form.  If I am not
missing some obvious (or subtle) reason why Lisp can't support macros
used in this way, may I propose this as an innovation for future
Lisp's.

       yt, Chuck Rich.