From: Eli Bendersky
Subject: Re: a short article about equality in Lisp (for beginners)
Date: 
Message-ID: <cf5oht$qam@odbk17.prod.google.com>
Larry Clapp wrote:
> In article <··········@odak26.prod.google.com>, Eli Bendersky wrote:
> > I came back to playing with Lisp recently, and naturally I
discovered
> > that I forgot how Lisp's equality operators - eq, eql, equal and
equalp
> > differ. To completely understand it,
> > I referred to the Hyperspec and two Lisp books. To avoid
> > this experience in the future, I summarized my "understanding"
> > in a short article:
> >
> > http://www.geocities.com/spur4444/prog/equality_in_lisp.html
>
> You say
>
>    Additionally, eq ignores the types of numbers (unlike =).
>
> I would say that eq *doesn't* ignore the type of numbers, whereas =
> *does*:

You're right, this is what happens with (reverse (reverse (semantics)))
:-)
I'll get it fixed

>two numbers of different types can still be =.  So, on some
> implementations (eq 4 4), and (eq 4.0 4.0), and some not[1], but on
no
> implementation is it true that (eq 4 4.0), whereas on every
> implementation it should be true that (= 4 4.0)
>
> -- Larry
>
>
> [1] And on some implementations (eq 4.0 4.0) and (not (eq 4.0 4.0))
at
> different times, e.g. cmucl:
>
>     USER> (eq 1.0 1.0)
>     NIL
>
>     USER> (defun foo () (eq 1.0 1.0))
>     FOO
>
>     USER> (foo)
>     T
>
> In the case of cmucl (as I understand it), this happens because it
> interprets the (eq 1.0 1.0), whereas it compiles (slightly; not to
> machine code) the function FOO.