From: Philippe DEJEAN
Subject: Just two question about vectors in CMU/CL
Date:
Message-ID: <33203D29.2014@irit.fr>
I'm translating a big project writen in Le_lisp into CMU/CL. In a part
of this project, I have to compare two vector.
In Le_lisp
(equal (vector ()()()) (vector ()()()) returns t
Why CMU/CL returns nil ?
And how can I compare direcly, of course, two vectors ?
Thank you for yours answer
Philippe.
--
------------------------------------------------------------------------
Philippe DEJEAN INSTITUT DE RECHERCHE EN
INFORMATIQUE DE TOULOUSE
e-mail : ······@irit.fr Pole 2IST
Tel : (33 5) (05) 61 55 63 09 Equipe TCI
Fax : (33 5) (05) 61 55 62 58
http://www.irit.fr/~Philippe.Dejean
------------------------------------------------------------------------
From: Erik Naggum
Subject: Re: Just two question about vectors in CMU/CL
Date:
Message-ID: <3066741424033988@naggum.no>
* Philippe DEJEAN
| Why CMU/CL returns nil?
because it implements Common Lisp.
| And how can I compare direcly, of course, two vectors?
use `equalp'.
#\Erik
--
if you think big enough, you never have to do it
Philippe DEJEAN wrote:
>
> I'm translating a big project writen in Le_lisp into CMU/CL. In a part
> of this project, I have to compare two vector.
> In Le_lisp
>
> (equal (vector ()()()) (vector ()()()) returns t
>
> Why CMU/CL returns nil ?
(vector () () ()) returns a piece of memory holding three pointers.
[The three pointers all point to nil, but that's not important
here.] The second call to (vector () () ()) returns a
**different** piece of memory holding three pointers. Since
the two pieces of memory are not exactly the same object,
"equal" returns nil.
As Steele's book says, "Two arrays are equal only if they are
eq, with one exception: strings and bit-vectors..."
equalp will do what you want.