Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Just two question about vectors in CMU/CL

2 views
Skip to first unread message

Philippe DEJEAN

unread,
Mar 7, 1997, 3:00:00 AM3/7/97
to

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 : dej...@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
------------------------------------------------------------------------

Erik Naggum

unread,
Mar 7, 1997, 3:00:00 AM3/7/97
to

* 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

Mark McConnell

unread,
Mar 10, 1997, 3:00:00 AM3/10/97
to

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.

0 new messages