Subject: Re: Two questions about eq
From: rpw3@rpw3.org (Rob Warnock)
Date: Tue, 01 Apr 2008 06:46:49 -0500
Newsgroups: comp.lang.lisp
Message-ID: <wOGdne-cTI80vW_anZ2dnUVZ_tCrnZ2d@speakeasy.net>
Brian  <quickbasicguru@gmail.com> wrote:
+---------------
| Spiros Bousbouras wrote:
| > 2) Under what (realistic) circumstances might
| > (eq 1 1) be false ?
| An implementation could create two different 1 objects.  According to
| Cliki at least, in ABCL EQL fixnums are not EQ.  (I'm having trouble
| duplicating that though).
+---------------

Try using larger fixnums. Some implementations of Lisp/Scheme
"intern" a few fixnums close to zero [to avoid excess consing
of small temps in loops], but cons up all others. A notable example
of this was SIOD Scheme, which typically "interned" the integers
0-255 [in one version] or 0-2047 [in another], but provided a
command-line option ("-n") to adjust this:

    $ siod -n2048
    ...[chatter]...
    > (eq? 1 1)
    t
    > (eq? 2047 2047)
    t
    > (eq? 2048 2048)
    ()
    > (eq? 12345 12345)
    ()
    > 


-Rob

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