Re: What do we mean by "Identical" ?



newser.bbs@xxxxxxxxxxxxxxxxx writes:

> Thanks for all the replies.
> I try to find the answer in CLtL2 , and the follwoing is what it says
> in the "6.3. Equality Predicates":
>
> "(eq x y) is true if and only if x and y are the same identical object.
> (Implementationally, x and y are usually eq if and only if they address
> the same identical memory location.) "
>
> So, while eq return true , the 2 following objects are really identical
> , not only evaluated to the same thing .

You are confusing yourself with naming.

Consider this: Is the letter `x' the same thing as the letter `y'?
Of course not. Yet it is possible for (eq x y) to return true. How
can this be?

When I write (eq x y), I don't mean that I should check whether the
identifier X is the same as the identifier Y. It obviously isn't. I
want to check if the *value* of the variable X is the same as the
*value* of the variable Y.

> Now I got more and more confused :
> If nil and 'nil are really identical (as shown by T=(eq nil 'nil)), why
> not ''nil ='('nil)='nil=nil ?

Forget nil. Try this:

(defconstant foo 'bar) ;; define a constant foo with value 'bar

(eq foo 'bar) ;; returns true

(eq 'foo ''bar) ;; returns false

Do you understand this?

> OK , I am willing to forget this problem , but I beg someone's answer
> for another question:
> Do you really think that nil and 'nil take the same identical memory
> locations ?

The value of the variable NIL is the symbol NIL.
.