     2 fixnum+fast [ set-slot ] 2keep
     1 fixnum+fast set-slot ; inline
 
-: (rehash) ( hash alist -- )
-    swap [ swapd dupd new-key@ set-nth-pair ] curry assoc-each ; inline
+: (set-at) ( value key hash -- )
+    dupd new-key@ set-nth-pair ; inline
+
+: (rehash) ( alist hash -- )
+    [ swapd (set-at) ] curry assoc-each ; inline
 
 : hash-large? ( hash -- ? )
     [ count>> 3 fixnum*fast 1 fixnum+fast ]

        [ >alist { array } declare ]
        [ assoc-size 1 + ]
        [ reset-hash ] tri
    ] keep swap (rehash) ;

: ?grow-hash ( hash -- )
    dup hash-large? [ grow-hash ] [ drop ] if ; inline

M: f new-assoc drop <hashtable> ; inline

: >hashtable ( assoc -- hashtable )
    [ >alist ] [ assoc-size <hashtable> ] bi [ (rehash) ] keep ;

M: hashtable assoc-like
    drop dup hashtable? [ >hashtable ] unless ; inline
