From f2aa8ec87635db91d52f5d2bb03627ecace35c65 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Sat, 3 Sep 2011 14:46:26 -0700 Subject: [PATCH] hash-sets: initialize hashtable capacity to length of sequence. --- core/hash-sets/hash-sets.factor | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/hash-sets/hash-sets.factor b/core/hash-sets/hash-sets.factor index 028c324f6a..6a03bd02d9 100644 --- a/core/hash-sets/hash-sets.factor +++ b/core/hash-sets/hash-sets.factor @@ -9,7 +9,9 @@ IN: hash-sets TUPLE: hash-set { table hashtable read-only } ; : ( members -- hash-set ) - H{ } clone [ [ dupd set-at ] curry each ] keep hash-set boa ; + dup length [ + [ dupd set-at ] curry each + ] keep hash-set boa ; INSTANCE: hash-set set M: hash-set in? table>> key? ; inline