Subject: Re: Newbie variable question
From: rpw3@rpw3.org (Rob Warnock)
Date: Sat, 22 Feb 2003 03:08:56 -0600
Newsgroups: comp.lang.lisp
Message-ID: <sjWdne8g_7i1o8qjXTWc-w@speakeasy.net>
Adam Warner <usenet@consulting.net.nz> wrote:
+---------------
| >  (eq 42 42)
| > 
| > Will this be true?  We don't know.
| 
| We can only accept that (eq 42 42) may not be true because we
| have a model of the machine representations of 42.
+---------------

Well, that (eq 42 42) might not be true is generally hard for newbies --
or even anyone who's looked a bit at implementation -- to understand,
especially since in every Common Lisp implementation they're going to run
into it *is* true (as a happy accident of any reasonable implementation)
that "equal" fixnums are "eq":

    > (eq 42 42)
    T
    > most-positive-fixnum	; some sample implementation
    536870911
    > (eq 536870911 536870911)
    T
    > (let ((x most-positive-fixnum))
        ;; even more confusing
        (eq (+ 41 (floor x 53) -4) (+ 37 (/ (- 536870911 44) 53))))
    T
    >

So when we talk about this issue, we really should be using examples
that make it more obvious that "eq" might *not* compare true, e.g.,
something like (expt 2 100):

    > (eql 1267650600228229401496703205376 1267650600228229401496703205376)
    T
    > (eq 1267650600228229401496703205376 1267650600228229401496703205376)
    NIL
    > 


-Rob

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