]> gitweb.factorcode.org Git - factor.git/commitdiff
math.statistics: Median now changes the order of the sequence, so clone it first.
authorDoug Coleman <doug.coleman@gmail.com>
Sun, 24 Mar 2013 08:08:28 +0000 (01:08 -0700)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 24 Mar 2013 08:08:28 +0000 (01:08 -0700)
basis/math/statistics/statistics.factor

index 90a7fcadc5e179e2befb9f2aeda2310a2409e074..68800d95901f03d07e83464aea9df494d7f737bf 100644 (file)
@@ -151,6 +151,7 @@ PRIVATE>
     bi kth-smallests first2 ;
 
 : median ( seq -- x )
+    clone
     dup length odd? [ lower-median ] [ medians + 2 / ] if ;
 
 ! quantile can be any n-tile. quartile is n = 4, percentile is n = 100