]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/reports/noise/noise.factor
factor: trim using lists
[factor.git] / extra / reports / noise / noise.factor
index 8f30dd4244454b27b9cbb98694ddd7e88f027e56..00b452694e85c6c648afdb2c5ae83360bc89809e 100644 (file)
@@ -3,8 +3,7 @@
 USING: accessors assocs math kernel shuffle generalizations
 words quotations arrays combinators sequences math.vectors
 io.styles prettyprint vocabs sorting io generic
-math.statistics math.order locals.types
-locals.definitions ;
+math.order locals.types locals.definitions ;
 IN: reports.noise
 
 : badness ( word -- n )
@@ -87,8 +86,8 @@ M: array noise [ noise ] map vsum ;
 : noise-factor ( x y -- z ) / 100 * >integer ;
 
 : quot-noise-factor ( quot -- n )
-    #! For very short words, noise doesn't count so much
-    #! (so dup foo swap bar isn't penalized as badly).
+    ! For very short words, noise doesn't count so much
+    ! (so dup foo swap bar isn't penalized as badly).
     noise first2 {
         { [ over 4 <= ] [ [ drop 0 ] dip ] }
         { [ over 15 >= ] [ [ 2 * ] dip ] }
@@ -120,7 +119,7 @@ M: lambda-word word-noise-factor
 
 : noisy-words ( -- alist )
     all-words flatten-generics
-    [ dup word-noise-factor ] { } map>assoc
+    [ word-noise-factor ] zip-with
     sort-values reverse ;
 
 : noise. ( alist -- )
@@ -140,7 +139,7 @@ M: lambda-word word-noise-factor
     ] if-empty ;
 
 : noisy-vocabs ( -- alist )
-    loaded-vocab-names [ dup vocab-noise-factor ] { } map>assoc
+    loaded-vocab-names [ vocab-noise-factor ] zip-with
     sort-values reverse ;
 
 : noise-report ( -- )