Subject: Re: cons to the same object
From: (Rob Warnock)
Date: Fri, 16 Mar 2007 04:16:28 -0500
Newsgroups: comp.lang.lisp
Message-ID: <>
Frode Vatvedt Fjeld  <> wrote:
| Steven Haflich <> writes:
| > However, eql in typical implementations is a rather more expensive
| > operation than eq in the false case.  That is sufficient reason for
| > using eq when the arguments are known not to be numbers or
| > characters.
| This was my conclusion also, the last time this was discussed here,
| maybe a couple of years ago: Treat EQ as a shortcut for something
| approximately like
|   (eql (the (not (or number character)) x)
|        (the (not (or number character)) y))

Conversely, one may hope that the implementation of EQL is always
at *least* as good as this:

    (or (eq x y)
	(and (characterp x) (characterp y) (char= x y))
	(and (numberp x) (numberp y) (= x y)))

which isn't actually all that slow except for the leaf cases
of "char=" with hugely-complex Unicode and "=" with bignums.


Rob Warnock			<>
627 26th Avenue			<URL:>
San Mateo, CA 94403		(650)572-2607