Subject: Re: Confused by behavior of LispWorks for code snippet
From: rpw3@rpw3.org (Rob Warnock)
Date: Mon, 01 Oct 2007 04:21:37 -0500
Newsgroups: comp.lang.lisp
Message-ID: <YrKdnS1bPvi8IZ3anZ2dnUVZ_rSinZ2d@speakeasy.net>
Damien Kick  <dkixk@earthlink.net> wrote:
+---------------
| Rob Warnock wrote:
| > I don't use LispWorks, so this may be a totally wild hair,
| > but try (SETF (FDEFINITION 'F) *X*) and see what happens.
...
| CL-USER 1 > (defparameter *x* #'(lambda () 13))
| *X*
| 
| CL-USER 2 > (setf (fdefinition 'f) *x*)
| #<anonymous interpreted function 200C9212>
| 
| CL-USER 3 > (setf (fdefinition 'g) *x*)
| #<anonymous interpreted function 200C9212>
| 
| CL-USER 4 > (eq #'f #'g)
| NIL
+---------------

Wow! That's especially weird, given that the address printed
is the same for both. Oh, wait a minute: SETF returns the value
being stored, *not* necessarily the new value of the location
being stored into. Try this: After doing the above, see what
(FDEFINITION 'F) & (FDEFINITION 'G) print at the REPL, and also
what #'F & #'G print, and whether those four values print the
same as *X* prints. It may be that there is some sort of implicit
wrapper around an FDEFINITION (or SYMBOL-FUNCTION) of a symbol
that's added whenever a new function value is stored into them.
and that function identity is really identity of the wrapper.

[In CMUCL & CLISP all five are the same, but clearly LispWorks
is different somehow.]

Also, what do (EQ *X* *X*) and (EQ #'F #'F) give? 
*Those*, at least, should both return T...


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607