[Openmcl-devel] SETQ

Tobias C. Rittweiler tcr at freebits.de
Wed Dec 17 01:23:43 PST 2008


Robert Boyer <boyer at cs.utexas.edu> writes:

> > SETQ is a special form. It cannot be written by a
> > simple macro.
>
> I get dumber every day, but I increasingly enjoy it
> every time that someone shows me how wrong I am.
>
> What's so bad about:
>
>   (defmacro new-setq (x y) `(set ',x ,y))

SET does not work on lexical variables.

    CL-USER> (boundp 'foo)
    NIL

    CL-USER> (let ((foo :lexical))
               (values foo
                       (set 'foo :value)
                       foo))
	   
    :LEXICAL
    :VALUE
    :LEXICAL

    CL-USER> (values (boundp 'foo) foo)
    T
    :VALUE



> In my remarks, I was thinking rhetorically and
> historically about Lisp way back at its creation in the
> 50s, way before the terms 'special form' and 'special
> operator' and 'special' were coined.  No doubt you are
> right, though, in a fine sense.

Historically you're right, of course. That is before the introduction of
lexical variables. I wouldn't be surprised if the MacLisp compiler and
interpreter dealt with SETQ differently! :-)

  -T.




More information about the Openmcl-devel mailing list