guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Are `eqv?' and `eq?' the same?


From: Ian Price
Subject: Re: Are `eqv?' and `eq?' the same?
Date: Sun, 25 Aug 2013 21:13:14 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux)

Alexandru Cojocaru <address@hidden> writes:

>     `eq?' tests just for the same object (essentially a pointer
> comparison)
>     `eqv?' extends `eq?' to look at the value of numbers and
> characters.
>
> this is what I get:
>
>     scheme@(guile-user)> (eq? 3 (+ 1 2))
>     $1 = #t
>
> is this behavior intentional or some type of bug?
The wording seems less than ideal, but the behaviour is perfectly
fine, at least as far as the standard is concerned.

Having said that my advice, to you, and to everyone reading this, is
basically always use eqv?. No correct program will ever be broken by
using it and the efficiency gains if eq? are marginal.

-- 
Ian Price -- shift-reset.com

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]