Handbook
Glossary
full-node
Vocabulary
persistent
.
hashtables
.
nodes
Definition
USING:
arrays
math
;
IN:
persistent.hashtables.nodes
TUPLE:
full-node
{
nodes
array
read-only
initial:
{
}
}
{
shift
fixnum
read-only
initial:
0
}
{
hashcode
fixnum
read-only
initial:
0
}
;
Methods
USING:
accessors
persistent.hashtables.nodes
sequences.private
;
M::
full-node
(entry-at)
( key hashcode full-node -- entry )
key hashcode hashcode full-node
shift>>
mask
full-node
nodes>>
nth-unsafe
(entry-at)
;
USING:
accessors
kernel
math
persistent.hashtables.config
persistent.hashtables.nodes
persistent.sequences
sequences.private
;
M::
full-node
(new-at)
( shift value key hashcode full-node -- node' added-leaf )
full-node
nodes>>
:>
nodes hashcode full-node
shift>>
mask
:>
idx idx nodes
nth-unsafe
:>
n shift
radix-bits
+
value key hashcode n
(new-at)
:>
( n' new-leaf ) n n'
eq?
[
full-node
]
[
n' idx nodes
new-nth
shift
<full-node>
]
if
new-leaf
;
USING:
accessors
kernel
math
persistent.hashtables.config
persistent.hashtables.nodes
persistent.sequences
sequences
;
M::
full-node
(pluck-at)
( key hashcode full-node -- node' )
hashcode full-node
shift>>
mask
:>
idx idx full-node
nodes>>
nth
:>
n key hashcode n
(pluck-at)
:>
n' n n'
eq?
[
full-node
]
[
n'
[
n' idx full-node
nodes>>
new-nth
full-node
shift>>
<full-node>
]
[
hashcode full-node
shift>>
bitpos
bitnot
full-bitmap-mask
bitand
idx full-node
nodes>>
remove-nth
full-node
shift>>
<bitmap-node>
]
if
]
if
;
USING:
accessors
persistent.hashtables.nodes
;
M:
full-node
>alist%
nodes>>
>alist-each%
;