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 )
: 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 ] }
: noisy-words ( -- alist )
all-words flatten-generics
- [ dup word-noise-factor ] { } map>assoc
+ [ word-noise-factor ] zip-with
sort-values reverse ;
: noise. ( alist -- )
] 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 ( -- )