----- Original Message ----- 
From: "Detlef Groth" <[EMAIL PROTECTED]>

> After consulting the php-sources I could hack the tclsqlite.c file
> myself to add aggregation capabilities to tcl, this should go into the
> next release:

This looks good. I'm surprised it didn't exist already.

> proc MedianAggFin {} {
>      global l
>      # this is just executed ones
>      return [lindex [lsort -integer $l] [expr round([llength $l] / 2)]]
> }

FYI, the definition of the median depends upon the length of the sequence.
For an odd number of items, the median is the value of the central item. For
an even number of items, the median is the mean of the two central items.

For example: 3 items [1, 2, 3] the median is 2, and 4 items [1, 2, 3, 4] the
median is (2 + 3)/2 or 2.5.

See http://mathworld.wolfram.com/StatisticalMedian.html for more details.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to