Better hashcodes
parent
1cc72a386e
commit
d5667fd4b1
|
@ -225,9 +225,10 @@ M: tuple equal?
|
|||
|
||||
M: tuple hashcode*
|
||||
[
|
||||
dup tuple-size -rot 0 -rot [
|
||||
swapd array-nth hashcode* bitxor
|
||||
] 2curry reduce
|
||||
[ class hashcode ] [ tuple-size ] [ ] tri
|
||||
>r rot r> [
|
||||
swapd array-nth hashcode* sequence-hashcode-step
|
||||
] 2curry each
|
||||
] recursive-hashcode ;
|
||||
|
||||
! Deprecated
|
||||
|
|
|
@ -118,6 +118,8 @@ GENERIC: hashcode* ( depth obj -- code )
|
|||
|
||||
M: object hashcode* 2drop 0 ;
|
||||
|
||||
M: f hashcode* 2drop 31337 ;
|
||||
|
||||
: hashcode ( obj -- code ) 3 swap hashcode* ; inline
|
||||
|
||||
GENERIC: equal? ( obj1 obj2 -- ? )
|
||||
|
|
Loading…
Reference in New Issue