Handbook
Glossary
number-hashcode ( x -- h )
Vocabulary
math
.
hashcodes
Inputs
x
an
object
Outputs
h
an
object
Definition
IN:
math.hashcodes
GENERIC:
number-hashcode
( x -- h )
Methods
USING:
kernel
layouts
math
math.bitwise
math.hashcodes
;
M:
complex
number-hashcode
>rect
[
number-hashcode
]
bi@
1000003
*
+
cell-bits
on-bits
bitand
dup
-1
=
[
drop
-2
]
when
;
USING:
combinators
kernel
math
math.floating-point
math.hashcodes
;
M:
float
number-hashcode
{
{
[
dup
fp-nan?
]
[
drop
0
]
}
{
[
dup
fp-infinity?
]
[
0
>
314159 -314159
?
]
}
[
double>ratio
number-hashcode
]
}
cond
;
USING:
math
math.hashcodes
math.hashcodes.private
;
M:
integer
number-hashcode
1
hash-fraction
;
USING:
math
math.hashcodes
math.hashcodes.private
;
M:
ratio
number-hashcode
>fraction
hash-fraction
;