]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/tools/memory/memory.factor
Removing more >r/r> usages
[factor.git] / basis / tools / memory / memory.factor
index f61694da786753ac13da6b22cc7bd13cb381bc70..70f9a10a5134c934b114baf5118efa9c7600679b 100644 (file)
@@ -3,7 +3,7 @@
 USING: kernel sequences vectors arrays generic assocs io math
 namespaces parser prettyprint strings io.styles vectors words
 system sorting splitting grouping math.parser classes memory
-combinators ;
+combinators fry ;
 IN: tools.memory
 
 <PRIVATE
@@ -51,9 +51,10 @@ IN: tools.memory
         [ "Largest free block:" write-labelled-size ]
     } spread ;
 
-: heap-stat-step ( counts sizes obj -- )
-    [ dup size swap class rot at+ ] keep
-    1 swap class rot at+ ;
+: heap-stat-step ( obj counts sizes -- )
+    [ over ] dip
+    [ [ [ drop 1 ] [ class ] bi ] dip at+ ]
+    [ [ [ size ] [ class ] bi ] dip at+ ] 2bi* ;
 
 PRIVATE>
 
@@ -71,7 +72,7 @@ PRIVATE>
 
 : heap-stats ( -- counts sizes )
     H{ } clone H{ } clone
-    [ >r 2dup r> heap-stat-step ] each-object ;
+    2dup '[ _ _ heap-stat-step ] each-object ;
 
 : heap-stats. ( -- )
     heap-stats dup keys natural-sort standard-table-style [