[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Historical clarification on &PROTECT
- Subject: Re: Historical clarification on &PROTECT
- From: Kent M. Pitman <KMP at MIT-MC>
- Date: Wed ,12 Nov 80 14:03:00 EDT
Date: 11 November 1980 12:06-EST
From: Jon L White <JONL>
.. I might mention as RMS did that some "cleaner" version of DEFSUBST is
what many users (you included) have apparently wanted, but been lacking.
The Berkeley crowd diddled their macro definer to get some minimal
capability (was it "&SAFE"?), and we've had DEFSIMPLEMAC for some time...
Actually, it was &PROTECT. It's in their DEFMACRO compatibility package I think
-- not a primitive part of Franz Lisp. Doesn't show up in the manual, anyway.
JKF's mail to MACSYMA-I on the subject follows for those interested in what it
Date: 17 Jul 1980 14:04:06-PDT
From: CSVAX.jkf at Berkeley
Re: special defmacro
We are converting many small functions to macros and have run into the
problems of a macro argument being evaluated twice. In the case of
atoms, this does not matter, but of course is does for function calls.
I added a special clause to our defmacro, called &protect, which
checks at macro expansion time if certain macro formal variables
are bound to lists, in which case it surrounds the macro with a lambda
expression. I recall you doing something like this a while ago
and I would like to see what your syntax for this is.
An example is:
(defmacro EVEN (&protect (A) A) `(AND (FIXP ,A) (NOT (ODDP ,A))))
I presume this means that
(EVEN X) => (AND (FIXP X) (NOT (ODDP X)))
(EVEN (F)) => ((LAMBDA (G0001) (AND (FIXP G0001) (NOT (ODDP G0001)))) (F))