From 60919f8a89e85aa4d2156c5e98cef4351c0c37b9 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Wed, 28 Dec 2016 13:39:52 -0800 Subject: [PATCH] math.statistics: change minmax to not look at first element twice. --- basis/math/statistics/statistics.factor | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/basis/math/statistics/statistics.factor b/basis/math/statistics/statistics.factor index a67591ea84..fe18d0c855 100644 --- a/basis/math/statistics/statistics.factor +++ b/basis/math/statistics/statistics.factor @@ -229,7 +229,7 @@ PRIVATE> histogram >alist [ second ] supremum-by first ; : minmax ( seq -- min max ) - [ first dup ] keep [ [ min ] [ max ] bi-curry bi* ] each ; + [ first dup ] keep [ [ min ] [ max ] bi-curry bi* ] 1 each-from ; : range ( seq -- x ) minmax swap - ; @@ -245,8 +245,7 @@ PRIVATE> : sample-var ( seq -- x ) 1 var-ddof ; inline -: std-ddof ( seq n -- x ) - var-ddof sqrt ; inline +: std-ddof ( seq n -- x ) var-ddof sqrt ; inline : population-std ( seq -- x ) 0 std-ddof ; inline