|(require rebellion/equal+hash)||package: rebellion|
(make-accessor-based-equal+hash accessor size) → equal+hash/c accessor : (-> any/c natural? any/c) size : natural?
Builds an equality-checking function, a hashing function, and a secondary hashing function suitable for use with prop:equal+hash. These functions extract size fields from values using accessor and recursively compare and hash them. This function is typically not used directly; instead clients are expected to use one of make-struct-equal+hash or make-tuple-equal+hash.
= (list/c procedure? procedure? procedure?)
Builds an equality-checking function, a hashing function, and a secondary hashing function suitable for use with prop:equal+hash, each of which operate on instances of descriptor. All fields in descriptor are compared and hashed by the returned procedures. This causes equal? to behave roughly the same as it does on transparent structure types.
> (struct opaque-point (x y)) > (equal? (opaque-point 1 2) (opaque-point 1 2))
> (define point-descriptor (make-struct-implementation #:name 'point #:immutable-fields 2 #:property-maker (λ (descriptor) (define equal+hash (make-struct-equal+hash descriptor)) (list (cons prop:equal+hash equal+hash))))) > (define point (struct-descriptor-constructor point-descriptor)) > (equal? (point 1 2) (point 1 2))