Re: Confused by behavior of LispWorks for code snippet



Tobias C. Rittweiler wrote:
Damien Kick <dkixk@xxxxxxxxxxxxx> writes:

I would've expected (EQ #'F #'G) => T. I am getting that result,
i.e. (EQ #'F #'G) => T, with both Allegro CL 8.0 and Clisp. Is
LispWorks mistaken or is that an allowable result?

FUNCTION is allowed to return a fresh function object.

I don't find anything in the hyperspec which seems to support this. I could very well be missing something, though. I do find

<blockquote>
If name is a lambda expression, then a lexical closure is returned. In situations where a closure over the same set of bindings might be produced more than once, the various resulting closures might or might not be eq.
</blockquote>

But there is only one LAMBDA involved and it should only be evaluated once.

But if that was the reason, I would expect that (EQ #'F #'F) => NIL, as FUNCTION would be returning a fresh function object every time, which hardly seems reasonable to me. Am I missing something?
.