Handbook
Glossary
persistent-hash
Vocabulary
persistent
.
hashtables
Definition
USING:
math
persistent.hashtables.nodes
;
IN:
persistent.hashtables
TUPLE:
persistent-hash
{
root
read-only
initial:
empty-node
}
{
count
fixnum
read-only
initial:
0
}
;
Methods
USING:
accessors
assocs
make
persistent.hashtables
persistent.hashtables.nodes
;
M:
persistent-hash
>alist
[
root>>
>alist%
]
{
}
make
;
USING:
assocs
persistent.hashtables
prettyprint.custom
;
M:
persistent-hash
>pprint-sequence
>alist
;
USING:
accessors
assocs
persistent.hashtables
;
M:
persistent-hash
assoc-size
count>>
;
USING:
accessors
assocs
kernel
math
persistent.hashtables
persistent.hashtables.nodes
;
M:
persistent-hash
at*
[
dup
hashcode
>fixnum
]
[
root>>
]
bi*
(entry-at)
dup
[
value>>
t
]
[
f
]
if
;
USING:
kernel
persistent.hashtables
;
M:
persistent-hash
clone
;
USING:
assocs
kernel
persistent.hashtables
;
M:
persistent-hash
equal?
over
persistent-hash?
[
assoc=
]
[
2drop
f
]
if
;
USING:
assocs
kernel
persistent.hashtables
;
M:
persistent-hash
hashcode*
nip
assoc-size
;
USING:
assocs
persistent.hashtables
;
M:
persistent-hash
keys
>alist
keys
;
USING:
accessors
kernel
math
persistent.assocs
persistent.hashtables
persistent.hashtables.nodes
;
M:
persistent-hash
new-at
[
[
0
]
3dip
[
dup
hashcode
>fixnum
]
[
root>>
]
bi*
(new-at)
1 0
?
]
[
count>>
]
bi
+
persistent-hash
boa
;
USING:
accessors
combinators
kernel
math
persistent.assocs
persistent.hashtables
persistent.hashtables.nodes
;
M:
persistent-hash
pluck-at
[
[
dup
hashcode
>fixnum
]
[
root>>
]
bi*
(pluck-at)
]
keep
{
{
[
2dup
root>>
eq?
]
[
nip
]
}
{
[
over
not
]
[
2drop
PH{
}
]
}
[
count>>
1
-
persistent-hash
boa
]
}
cond
;
USING:
persistent.hashtables
prettyprint.custom
;
M:
persistent-hash
pprint*
pprint-object
;
USING:
kernel
persistent.hashtables
prettyprint.custom
;
M:
persistent-hash
pprint-delims
drop
\
PH{
\
}
;
USING:
assocs
persistent.hashtables
;
M:
persistent-hash
values
>alist
values
;