On Sun, Mar 1, 2009 at 4:34 PM, Rob Rothwell <[email protected]> wrote:

> I notice that the current median is:
>
> median
>     "Return the middle element, or as close as we can get."
>
>     ^ self at: self size + 1 // 2
>
> Any reason not to make that accurate and return the average of the middle
> two values for collections containing an even number of items?
>
One nice thing about the existing definition is that you can use #median on
collections that are numeric based.  So, median of:
#( 'Ford' 'Audi' 'Nissan' 'Hyundai' ) median
would actually return in the current definition, but not in a 'statistical'
definition.  Similarly, #max and #min and #size would work for this,
although #sum wouldn't.

Chris
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to