Re: Are fixnums guaranteed to be `eq?` whenever they are `=`/`equal?` ?
Matthew Flatt <mflatt-sDh8Nw2yj/[email protected]>
| Newsgroups | gmane.comp.lang.racket.user,gmane.lisp.scheme.plt |
|---|---|
| Message-ID | <[email protected]> |
At Mon, 14 Mar 2016 19:43:51 -0400, Tony Garnock-Jones wrote: > Can I rely on the truth of the following: > > (implies (and (fixnum? x) (fixnum? y) (= x y)) > (eq? x y)) > > ? Yes, that's guaranteed by the docs. > I know I can rely on something similar for symbols. And keywords. > What other sorts of values can I rely on eq? being an appropriate > equivalence predicate for? Booleans, void, and characters with a scalar value under 256. Opaque objects like custodians and inspectors are also `equal?` only when they are `eq?`, but I'm not sure if that's the kind of thing you're looking for. Literal numbers, characters, strings, byte strings, or regular expressions in a program are also `eq?` when they are `equal?`, since they're interned. That's an property of where the values came from, though, as opposed to a property of the kind of value. -- 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+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit https://groups.google.com/d/optout.