Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!nosc!ucsd!rutgers!njin!princeton!phoenix!eliot From: eliot@phoenix.Princeton.EDU (Eliot Handelman) Newsgroups: comp.lang.lisp Subject: Re: Amusing Code Message-ID: <3520@phoenix.Princeton.EDU> Date: 24 Aug 88 17:12:03 GMT References: <389@soi.UUCP> <450@oravax.UUCP> Reply-To: eliot@phoenix.Princeton.EDU (Eliot Handelman) Organization: Princeton University, NJ Lines: 26 In article <389@soi.UUCP>, alex@soi.UUCP (Alex Zatsman) writes: ; It took me and few of my friends a while to figure out ; seemingly strange effect of TEST-STACK below. I thought ; other people will find it amusing too: ; ; (defvar *Stack*) ; ; (defun Push-Object (Object) (push Object (car *Stack*))) ; ; (defun Init-Stack () (setf *Stack* '((:Bottom-Frame)))) ; ; (defun Test-Stack () ; (Init-Stack) (print *Stack*) ; (Push-Object 11) (print *Stack*) ; (Init-Stack) (print *Stack*) (values)) ; After having called test-stack, have a look at #'init-stack. Miracle of miracles! Well, they all warned you about RPLACA, which is being called by PUSH. Of course it's trivial to obviate this effect, but at least it proves the existence of pointers. Thanks for an interesting example. -Eliot -- This message will cost the net hundreds if not thousands and perhaps millions billions trillions maybe even zillions of dollars to send everywhere.