samth
2018-12-3 18:04:28
(module ht racket/base
(define-struct x (f g) #:omit-define-syntaxes
#:property prop:equal+hash
(list (lambda (x y r)
(printf "equal?\n")
(r (x-f x) (x-f y)))
(lambda (x r)
(printf "hc1\n")
(r (x-f x)))
(lambda (x r)
(printf "hc2\n")
(r (x-f x)))))
(define equal-hash (make-hash))
(hash-set! equal-hash (make-x 1 0) 0)
(hash-set! equal-hash (make-x 1 1) 1)
(display (hash-count equal-hash))
(newline)
(define h (hash))
(hash-count (hash-set (hash-set h (make-x 1 0) 0) (make-x 1 1) 1)))
samth
2018-12-3 18:04:31
@cadr
cadr
2018-12-3 19:00:42
@samth I found that for structs we’re always computing the hash ourselves iterating over the field values etc no matter what, fixing it now
github2-x
2018-12-3 22:26:44