[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Using macros in Mapping functions
- To: BUG-LISPM at MIT-AI, BUG-LISP at MIT-AI, LISP-FORUM at MIT-AI
- Subject: Using macros in Mapping functions
- From: Charles Rich <Rich at MIT-AI>
- Date: Mon, 10 Nov 80 22:04:00 GMT
- Cc: KMP at MIT-AI, RICH at MIT-AI
- Original-date: 10 November 1980 17:04-EST
- Sender: GLR at MIT-AI
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.