     ] if ;
 
 M: disjoint-set clone
-    [ parents>> ] [ ranks>> ] [ counts>> ] tri [ clone ] tri@
-    disjoint-set boa ;
+    [ parents>> ] [ ranks>> ] [ counts>> ] tri
+    [ clone ] tri@ disjoint-set boa ;
 
 : assoc>disjoint-set ( assoc -- disjoint-set )
-    <disjoint-set>
-    [ '[ drop _ add-atom ] assoc-each ]
-    [ '[ _ equate ] assoc-each ]
-    [ nip ]
-    2tri ;
+    <disjoint-set> [
+        [ '[ drop _ add-atom ] assoc-each ]
+        [ '[ _ equate ] assoc-each ] 2bi
+    ] keep ;


GENERIC: equiv-set-size ( a disjoint-set -- n )

M: disjoint-set equiv-set-size [ representative ] keep count ;

GENERIC: equiv? ( a b disjoint-set -- ? )



<PRIVATE

: add-count ( p a disjoint-set -- )
    counts>> [ at '[ _ + ] ] [ swap change-at ] bi ; inline

: set-parent ( p a disjoint-set -- )
    parents>> set-at ; inline
