[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: doc eq? eqv? equal?
From: |
Marius Vollmer |
Subject: |
Re: doc eq? eqv? equal? |
Date: |
Fri, 20 Aug 2004 12:26:49 +0200 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux) |
Kevin Ryde <address@hidden> writes:
> In guile "(eq? x x)" is always going to be true, but I'm wondering if
> the docs should describe only the weaker r5rs behaviour, and advise
> eqv? for anything involving numbers.
Yes, comparing x with itself is probably rare and the general case
(eq? x y) is false for bignums. So eqv? is the right thing to use for
numbers. Or '=' if you want to make sure that you are dealing with
numbers.
guile> (eq? (expt 2 20) (expt 2 20))
#t
guile> (eq? (expt 2 40) (expt 2 40))
#f
guile> (eqv? (expt 2 40) (expt 2 40))
#t
guile> (= (expt 2 40) (expt 2 40))
#t