Page:AIM-453.djvu/41

From Wikisource
Jump to navigation Jump to search
This page has been validated.
Steele and Sussman
39
The Art of the Interpreter

constructing procedures, we find that CONS can be viewed as a constructor of modules, just as MAPGEN was. CONS constructs modules ("cons cells") which use SETQ to maintain a local state.

Side Effects and Equality

"Things are seldom what they seem,
Skim milk masquerades as cream..."
— Gilbert and Sullivan
(H.M.S. Pinafore)

"Plus ça change, plus c'est la même chose."
— Alphonse Karr

Our descriptions of SETQ and RPLACA, both informal and meta-circular, are imprecise. They admit a number of drastically different interpretations of the behavior of the system. We would all agree that for RPLACA to mean anything at all like what we want, the expression:

((LAMBDA (X)
         (PROGN (RPLACA X 'Z)
                (CAR X)))
 (CONS 'A '(B C)))

Puzzle #1

should evaluate to Z. But what about this case:

((LAMBDA (X Y)
         (PROGN (RPLACA X 'Z)
                (CAR Y)))
 (CONS 'A '(B C))
 (CONS 'A '(B C)))

Puzzle #2

Should this evaluate to A or Z? Nearly all LISP systems would produce A, but there are arguments for both possibilities. Similarly, should this: