From: ·········@sneakemail.com
Subject: test equal of two vectors
Date: 
Message-ID: <1103714964.324095.69750@c13g2000cwb.googlegroups.com>
Hello,
I want to know how to test equal of two simple vectors. The following
code using equal does not work in clisp:
[27]> (setf v #(5 10 15))
#(5 10 15)
[28]> v
#(5 10 15)
[29]> (equal v #(5 10 15))
NIL

I also tried eql, eq, none of them work.
Thanks.

Zhang Le

From: Pascal Bourguignon
Subject: Re: test equal of two vectors
Date: 
Message-ID: <87llbqd0lz.fsf@thalassa.informatimago.com>
·········@sneakemail.com writes:

> Hello,
> I want to know how to test equal of two simple vectors. The following
> code using equal does not work in clisp:
> [27]> (setf v #(5 10 15))
> #(5 10 15)
> [28]> v
> #(5 10 15)
> [29]> (equal v #(5 10 15))
> NIL
> 
> I also tried eql, eq, none of them work.

Of course, since the specification of EQUAL  prevent it to return T
for vectors not EQ.

If you want to compare the contents of vectors, you must do it
yourself, or use EQUALP.

[1]> (setf v #(5 10 15))
#(5 10 15)
[2]> (equalp v #(5 10 15))
T

But note:


[3]> (setf v #("Zhang" "Le"))
#("Zhang" "Le")
[4]> (equalp v #("Zhang" "Le"))
T
[5]> (equalp v #("ZHANG" "LE"))
T
[6]> 


-- 
__Pascal_Bourguignon__               _  Software patents are endangering
()  ASCII ribbon against html email (o_ the computer industry all around
/\  1962:DO20I=1.100                //\ the world http://lpf.ai.mit.edu/
    2001:my($f)=`fortune`;          V_/   http://petition.eurolinux.org/
From: Kalle Olavi Niemitalo
Subject: Re: test equal of two vectors
Date: 
Message-ID: <87fz1ynk92.fsf@Astalo.kon.iki.fi>
Pascal Bourguignon <····@mouse-potato.com> writes:

> If you want to compare the contents of vectors, you must do it
> yourself, or use EQUALP.

You can also use (not (mismatch x y)), or (every #'eql x y) if
you already know that the lengths match.  In either case, you
first have to ensure that X and Y are sequences.  Both of these
forms can easily be made to use test functions other than EQL,
including recursive ones.