math.statistics: Median now changes the order of the sequence, so clone it first.

db4
Doug Coleman 2013-03-24 01:08:28 -07:00
parent 188d7e98df
commit bfbe6edde6
1 changed files with 1 additions and 0 deletions

View 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