Re: portable detection of special symbols?

On 23/04/2011 22:31, Pascal Costanza wrote:
On 23/04/2011 21:07, D Herring wrote:
Special Operator SYMBOL-MACROLET:
"symbol-macrolet signals an error if a special declaration names one of
the symbols being defined by symbol-macrolet"

Is there a better way not requiring the cltl2 environment interface?


(defun specialp (symbol)
(eval `(let ((,symbol 0))
(zerop (funcall (let ((,symbol 1))
(lambda () ,symbol)))))))

The following is a variant that moves some code out of the part evaluated at runtime:

(defun specialp (symbol)
(progv (list symbol) '(0)
(zerop (funcall (eval `(let ((,symbol 1))
(lambda () ,symbol)))))))


My website:
Common Lisp Document Repository:
Closer to MOP & ContextL:
The views expressed are my own, and not those of my employer.

Relevant Pages