Yes, Scheme (and therefore Racket) has eq?, eqv?, and equal?. I understand the 
desire for eq? and equal?, but I’ve always been skeptical of the necessity of 
eqv?. Either way, Scheme left this behavior unspecified, but I believe Racket 
specifies it (though I could be wrong).

Racket has two kinds of symbols, interned and uninterned. Symbols produced by 
the reader, whether via read or read-syntax, are interned. Additionally, 
string->symbol produces interned symbols. Certain functions such as gensym and 
string->uninterned-symbol produce uninterned symbols, but these are not 
commonly encountered, anyway.

Interned symbols, I believe, are guaranteed to be eq? since they’re, well, 
interned. There is a pool of interned symbols such that all symbols made up of 
the same string are all the same object, so they’re all eq?.

I can’t reproduce the behavior in the original message, and I don’t think it 
should be possible.

> On May 17, 2015, at 22:19, Michael Tiedtke <michael.tied...@o2online.de> 
> wrote:
> 
> I'm new to Racket but even R5RS is rather clear about this issue:
> 
> (citation from doc/r5rs/r5rs-std/r5rs-Z-H-9.html)
>> (eq? 2 2)   ===>  unspecified
>> 
>> Rationale:   It will usually be possible to implement eq? much more 
>> efficiently than eqv?, for example, as a simple pointer comparison instead 
>> of as some more complicated operation. One reason is that it may not be 
>> possible to compute eqv? of two numbers in constant time, whereas eq? 
>> implemented as pointer comparison will always finish in constant time. Eq? 
>> may be used like eqv? in applications using procedures to implement objects 
>> with state since it obeys the same constraints as eqv?.
> 
> 
> You should use "=" with numbers as far as I remember.
> 
> 
> Il giorno 18/mag/2015, alle ore 02.41, George Neuner ha scritto:
> 
>> Hi,
>> 
>> On 5/17/2015 5:32 PM, Atticus wrote:
>>> ---------------------------
>>> $ racket
>>> Welcome to Racket v6.1.1.
>>>> (eq? 'l 'l)
>>> #f
>>>> (eq? 'l 'l)
>>> #t
>>>> 
>>> 
>>> $ racket --no-jit
>>> Welcome to Racket v6.1.1.
>>>> (eq? 'l 'l)
>>> #f
>>>> (eq? 'l 'l)
>>> #t
>>>> (eq? 'l 'l)
>>> #f
>>>> (eq? 'l 'l)
>>> #t
>>>> (eq? 'l 'l)
>>> #t
>>>> (eq? 'l 'l)
>>> #t
>>>> (eq? 'l 'l)
>>> #f
>>>> (eq? 'l 'l)
>>> #f
>>>> 
>>> 
>>> ---------------------------
>>> 
>>> How to reproduce this behaviour? Just start racket from the command line
>>> and type '(eq? 'l 'l), this should return #f (or sometimes #t). The next
>>> time the same expression returns #t. Whats also interesting is that with
>>> the command line option --no-jit the return value seems to randomly
>>> change between #t and #f.   ...
>> 
>> I can't reproduce this.  Might there have been some control characters 
>> accidentally in your input?
>> 
>> I have 6.1.1  32-bit and 64-bit on Windows 7, and 64-bit on Centos 6.6 and 
>> Ubuntu 14.04.  Tried them all  with and without JIT.  Also tried the repl in 
>> DrRacket on Windows (Linux are command line only).   All worked as expected.
>> 
>> George
>> 
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to racket-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to