On 6/11/04 Rick Measham wrote: >On Thu, 10 Jun 2004 [EMAIL PROTECTED] wrote: >> How about a DateTime::Span->midpoint method? > >On 11 Jun 2004, at 6:55 AM, Dave Rolsky replied: >> Let's wait and see if others ask for it. For now, let's just >>add those recipes to the faq. > >I'm not sure of the best namespace, but I can see a Util namespace >would be a good place for FRSs (Frequently Required Solutions)
Flavio's solutions are brief and efficient. Why not just have it in the FAQ, as Dave suggests? > use DateTime::Util::Stats qw/:all/; > # Solar Noon is the mean of sunrise and sunset: > my $mean = mean_datetime( @dt_list ) > # The mean is: round(scalar(@_) + 1 / 2) # IIRC > # therefore $median == $sunset > my $median = median_datetime( @dt_list ) > >On the other hand, maybe these should be DateTime::Set methods: > my $mean = $set->mean( $sunrise, $sunset ); > my $median = $set->median( $sunrise, $sunset ); Huh? I'm confused by your usage of 'mean' and 'median'. In the case in question, I think 'midpoint' is a much clearer term to use. My $.02. 1; - Bruce __bruce__van_allen__santa_cruz__ca__
