Revert "hash-sets,hashtables: improved key@ word"

This reverts commit 70c7f9e029.
char-rename
John Benediktsson 2016-10-06 11:18:35 -07:00
parent 6f10f06c27
commit db46b16d10
3 changed files with 6 additions and 14 deletions

View File

@ -1,17 +1,7 @@
! Copyright (C) 2010 Daniel Ehrenberg
! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays fry hash-sets hash-sets.private kernel math
prettyprint sequences sets sorting tools.test ;
FROM: hashtables.private => tombstone ;
! key@
{
{ { T{ tombstone } T{ tombstone } } f f }
{ { T{ tombstone } 123 } 1 t }
} [
"hi" 0 <hash-set> key@ 3array
123 HS{ 123 } key@ 3array
] unit-test
USING: accessors fry hash-sets kernel math prettyprint sequences
sets sorting tools.test ;
{ { 1 2 3 } } [ HS{ 1 2 3 } members natural-sort ] unit-test

View File

@ -35,7 +35,8 @@ TUPLE: hash-set
] if ; inline recursive
: key@ ( key hash -- array n ? )
array>> 2dup hash@ 0 (key@) ; inline
array>> dup length>> 0 eq?
[ no-key ] [ 2dup hash@ 0 (key@) ] if ; inline
: <hash-array> ( n -- array )
3 * 1 + 2/ next-power-of-2 +empty+ <array> ; inline

View File

@ -38,7 +38,8 @@ TUPLE: hashtable
] if ; inline recursive
: key@ ( key hash -- array n ? )
array>> 2dup hash@ 0 (key@) ; inline
array>> dup length>> 0 eq?
[ no-key ] [ 2dup hash@ 0 (key@) ] if ; inline
: <hash-array> ( n -- array )
3 * 1 + 2/ next-power-of-2 2 * +empty+ <array> ; inline