Revert "hash-sets,hashtables: make it so the array backing the hash is non-empty"
This reverts commit 6f10f06c27
.
char-rename
parent
db46b16d10
commit
8f6ac5d457
|
@ -10,10 +10,7 @@ IN: hash-sets
|
||||||
TUPLE: hash-set
|
TUPLE: hash-set
|
||||||
{ count array-capacity }
|
{ count array-capacity }
|
||||||
{ deleted array-capacity }
|
{ deleted array-capacity }
|
||||||
{ array array initial: {
|
{ array array } ;
|
||||||
T{ tombstone } T{ tombstone } T{ tombstone } T{ tombstone }
|
|
||||||
}
|
|
||||||
} ;
|
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
USING: accessors arrays assocs continuations fry hashtables
|
USING: accessors assocs continuations fry hashtables kernel make
|
||||||
hashtables.private kernel make math memory namespaces sequences
|
math namespaces sequences tools.test ;
|
||||||
tools.test ;
|
|
||||||
|
|
||||||
! hash@
|
|
||||||
{ 18 } [
|
|
||||||
77 20 f <array> hash@
|
|
||||||
] unit-test
|
|
||||||
|
|
||||||
{ H{ } } [ { } [ dup ] H{ } map>assoc ] unit-test
|
{ H{ } } [ { } [ dup ] H{ } map>assoc ] unit-test
|
||||||
|
|
||||||
|
@ -188,14 +182,5 @@ H{ } "x" set
|
||||||
|
|
||||||
{ 1 } [ 2 "h" get at ] unit-test
|
{ 1 } [ 2 "h" get at ] unit-test
|
||||||
|
|
||||||
! Previously this could break as hashtable new created a backing an
|
|
||||||
! empty backing array and the code assumed its length was > 0.
|
|
||||||
{ f f } [
|
|
||||||
compact-gc 77 hashtable new [ clone ] change-array at*
|
|
||||||
] unit-test
|
|
||||||
|
|
||||||
! Random test case
|
! Random test case
|
||||||
{ "A" } [
|
{ "A" } [ 100 iota [ dup ] H{ } map>assoc 32 over delete-at "A" 32 pick set-at 32 of ] unit-test
|
||||||
100 iota [ dup ] H{ } map>assoc 32 over
|
|
||||||
delete-at "A" 32 pick set-at 32 of
|
|
||||||
] unit-test
|
|
||||||
|
|
|
@ -4,16 +4,10 @@ USING: accessors arrays assocs kernel kernel.private math
|
||||||
math.private sequences sequences.private slots.private vectors ;
|
math.private sequences sequences.private slots.private vectors ;
|
||||||
IN: hashtables
|
IN: hashtables
|
||||||
|
|
||||||
! Required because the hashtable definition references tombstone.
|
|
||||||
<PRIVATE PRIVATE>
|
|
||||||
|
|
||||||
TUPLE: hashtable
|
TUPLE: hashtable
|
||||||
{ count array-capacity }
|
{ count array-capacity }
|
||||||
{ deleted array-capacity }
|
{ deleted array-capacity }
|
||||||
{ array array initial: {
|
{ array array } ;
|
||||||
T{ tombstone } T{ tombstone } T{ tombstone } T{ tombstone }
|
|
||||||
}
|
|
||||||
} ;
|
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue