hash-sets: initialize hashtable capacity to length of sequence.

db4
John Benediktsson 2011-09-03 14:46:26 -07:00
parent 863262ece7
commit f2aa8ec876
1 changed files with 3 additions and 1 deletions

View File

@ -9,7 +9,9 @@ IN: hash-sets
TUPLE: hash-set { table hashtable read-only } ;
: <hash-set> ( members -- hash-set )
H{ } clone [ [ dupd set-at ] curry each ] keep hash-set boa ;
dup length <hashtable> [
[ dupd set-at ] curry each
] keep hash-set boa ;
INSTANCE: hash-set set
M: hash-set in? table>> key? ; inline