[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: RIVEST at MIT-ML
- Subject: backquote
- From: ALAN at MIT-MC (Alan Bawden)
- Date: Wed, 30 Jan 80 17:57:00 GMT
- Cc: (BUG LISP) at MIT-MC
- Original-date: 30 JAN 1980 1257-EST
It is not true that there is no way to accomplish what you wish with
the current backquote. What I think you want is this:
(defmacro setprop (x y z)
`(prog2 (putprop ,x ,y ,z)
(defmacro ,z(v) `(get ,v ',',z))))
This means that a form like (setprop a b c) produces a macro named
c that is defined as (defmacro c (v) `(get ,v 'c)) which I presume
is what you want, right?
I have inserted a quote between the two commas to prevent z from
being "evaluated twice" (that is, to prevent the result of evaluating
z from being reevaluated at the time the macro named ,z is invoked).
There are occasions when you want such double evaluation to happen
so to change backquote in the way you suggest would be breaking it.
You are quite correct that there is no good explaination of this
anywhere. (Probably because it is damned difficult to explain!)
Probably the next LispMachine manual will contain a "double backquote
cookbook" to help macro defining macro writers to stay sane.