[plt-scheme] Immutable mappings on symbols

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Thu Jan 13 18:27:50 EST 2005

Carl Eastlund wrote:

> It seems to me the eq-hash-order and equal-hash-order units would
> provide only approximate orderings, because different items can
> (rarely) be given the same hash code by (eq-hash-code ...) and
> (equal-hash-code ...).  Is this the case?  


> Or does the set unit do
> something intelligent in the rare case that equality can be tested
> where less-than cannot?

 From ordered.scm:

   (define eq-hash-order@ (predicates->ordered eq?
                                               (lambda (x y) (< (eq-hash-code x) (eq-hash-code y)))
                                               (lambda (x y) (or (eq? x y)
                                                                 (< (eq-hash-code x) (eq-hash-code y))))))

   (define equal-hash-order@ (predicates->ordered equal?
                                                  (lambda (x y) (< (equal-hash-code x) (equal-hash-code y)))
                                                  (lambda (x y) (or (equal? x y)
                                                                    (< (equal-hash-code x) (equal-hash-code y))))))

Jens Axel Søgaard

Posted on the users mailing list.