]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/math/statistics/statistics.factor
math.statistics: fix typo
[factor.git] / basis / math / statistics / statistics.factor
index 8be9dae79b86c1e74d0d85c76f583297d06f1e78..ab5e10a6e6aa5ac359725f038790b2c9600a573f 100644 (file)
@@ -124,7 +124,7 @@ PRIVATE>
     k seq nth-unsafe ; inline
 
 : (kth-object) ( seq k nth-quot exchange-quot quot: ( x y -- ? ) -- elt )
-    ! The algorithm modifiers seq, so we clone it
+    ! The algorithm modifies seq, so we clone it
     [ >array ] 4dip kth-object-impl ; inline
 
 : kth-object-unsafe ( seq k quot: ( x y -- ? ) -- elt )
@@ -251,11 +251,14 @@ PRIVATE>
 : trimean ( seq -- x )
     quartile first3 [ 2 * ] dip + + 4 / ;
 
+: histogram-by! ( assoc seq quot: ( x -- bin ) -- hashtable )
+    rot [ '[ @ _ inc-at ] each ] keep ; inline
+
 : histogram! ( hashtable seq -- hashtable )
-    over '[ _ inc-at ] each ;
+    [ ] histogram-by! ; inline
 
 : histogram-by ( seq quot: ( x -- bin ) -- hashtable )
-    H{ } clone [ '[ @ _ inc-at ] each ] keep ; inline
+    [ H{ } clone ] 2dip histogram-by! ; inline
 
 : histogram ( seq -- hashtable )
     [ ] histogram-by ;