From ed2b5fed0e4171286e5718910dd3d13f97809b1c Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Thu, 10 Mar 2016 12:23:12 +0000 Subject: [PATCH] Tweak hash-order to fall back to datum-order on equal hash codes. --- prospect/hash-order.rkt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/prospect/hash-order.rkt b/prospect/hash-order.rkt index e34b2a7..f0707e0 100644 --- a/prospect/hash-order.rkt +++ b/prospect/hash-order.rkt @@ -9,4 +9,9 @@ (order 'hash-order any/c eq? - (lambda (a b) (< (eq-hash-code a) (eq-hash-code b))))) + (lambda (a b) + (define a-code (eq-hash-code a)) + (define b-code (eq-hash-code b)) + (or (< a-code b-code) + (and (= a-code b-code) + (eq? (datum-order a b) '<))))))