guile-user
[Top][All Lists]
Advanced

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

Re: Surprising behavior of eq?


From: John Cowan
Subject: Re: Surprising behavior of eq?
Date: Sun, 20 Sep 2020 17:42:27 -0400

On Sun, Sep 20, 2020 at 4:52 PM Linus Björnstam <linus.internet@fastmail.se>
wrote:

Just a quick note on guile: if you are testing equality against literals
> guile will optimize to the fastest kind. (equal? b 27) becomes (eq? b 27).


Indeed, it's a Good Thing if equal? starts out with an eqv? test (which
should be inlined except for number comparisons) and eqv? starts out with
an eq? test (which also should be inlined).  If the more fine-grained test
returns #t, the more coarse-grained one can safely return #t also.  This is
independent of literals, and should IMO be done by every Scheme.


reply via email to

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