Re: DateTime-Set.pm

2003-03-17 Thread Dave Rolsky
On Mon, 17 Mar 2003, Stephen R. Wilcoxon wrote: > > I guess this depends on your expectations. What do others think? Does > > truncating to the month include the month or not? > > I expect the same as fglock. If I'm truncating to something, I expect that > to be the smallest meaningful unit, so

Re: DateTime-Set.pm

2003-03-17 Thread Stephen R. Wilcoxon
On Thu 2003/03/13 11:21:04 CST, Dave Rolsky <[EMAIL PROTECTED]> writes: > On Thu, 13 Mar 2003 [EMAIL PROTECTED] wrote: > > truncate( to=>'month' ) is setting the month to 1. I think it should > > only do that if I asked to truncate to 'year', isn't it? Or maybe I'm > > doing something wrong. > >

Re: DateTime-Set.pm

2003-03-13 Thread Dave Rolsky
On Thu, 13 Mar 2003 [EMAIL PROTECTED] wrote: > > >> Dave wrote: > > >> In pseudo-code, I'd do ... > > > > > I'm writing some code to test it. > > It works! > > ..->new( > recurrence => sub { ... }, > start => optional, > end => optional, > } > > should I commit this? Sure, go for it. -dav

Re: DateTime-Set.pm

2003-03-13 Thread fglock
> On Thu, 13 Mar 2003 [EMAIL PROTECTED] wrote: > > >> Dave wrote: > >> In pseudo-code, I'd do ... > > > I'm writing some code to test it. It works! ..->new( recurrence => sub { ... }, start => optional, end => optional, } should I commit this? - Flavio S. Glock

Re: DateTime-Set.pm

2003-03-13 Thread John Peacock
Dave Rolsky wrote: truncate( to=>'month' ) is setting the month to 1. I think it should only do that if I asked to truncate to 'year', isn't it? Or maybe I'm doing something wrong. I guess this depends on your expectations. What do others think? Does truncating to the month include the month

Re: DateTime-Set.pm

2003-03-12 Thread Dave Rolsky
On Wed, 12 Mar 2003 [EMAIL PROTECTED] wrote: > DateTime::Set->new( recurrence => $string ); > where $string is any of the parameters accepted by both > DateTime::truncate() and DateTime::add(), such as 'day', 'year'. > If somebody really wants other recurrences, they could create their own > Da

Re: DateTime-Set.pm

2003-03-12 Thread fglock
I propose DateTime::Set->new( recurrence => $string ); where $string is any of the parameters accepted by both DateTime::truncate() and DateTime::add(), such as 'day', 'year'. If somebody really wants other recurrences, they could create their own DateTime-derived class and override

Re: DateTime-Set.pm

2003-03-12 Thread fglock
> Why does the DateTime::Set class need to get both dates back? I think that's what is confusing me. > Another option: the callback receives a start date and an end date parameters, and it returns the list of the dates that are in that time span. This looks much simpler, and it solves th

Re: DateTime-Set.pm

2003-03-11 Thread fglock
> Why does the DateTime::Set class need to get both dates back? I think that's what is confusing me. Another option: the callback receives a start date and an end date parameters, and it returns the list of the dates that are in that time span. This looks much simpler, and it solves the pro

Re: DateTime-Set.pm

2003-03-10 Thread fglock
Oops. There was an error in my example, I didn't truncate the second return value. > Why does the DateTime::Set class need to get both dates back? I think that's what is confusing me. It needs 'random access' to the recurrence, such that it can construct the set of ocurrences for a give

Re: DateTime-Set.pm

2003-03-10 Thread Dave Rolsky
On Mon, 10 Mar 2003 [EMAIL PROTECTED] wrote: > The callback receives a DateTime parameter. The callback must return 2 > values: the value of the recurrence just before the date (that is, the > truncated value), and the value of the recurrence after the date. > > For example - a yearly recurrence:

Re: DateTime-Set.pm

2003-03-10 Thread fglock
> The sub that generates recurrences can be responsible for truncation, right? Right! I just found a way: The callback receives a DateTime parameter. The callback must return 2 values: the value of the recurrence just before the date (that is, the truncated value), and the value of the recurr

Re: DateTime-Set.pm

2003-03-10 Thread fglock
> The sub that generates recurrences can be responsible for truncation, right? Yes, but it needs to know "which" truncation to do. I think we could use an interface like this: new( callback => sub { . }, freq => 'year' ); The callback would be called with a parameter like "2003-01-01" (bec

Re: DateTime-Set.pm

2003-03-10 Thread Dave Rolsky
On Fri, 7 Mar 2003, fglock wrote: > Although $recurr_months was defined as "start=>NEG_INFINITY", > the equation solver inside Set::Infinite will substitute > that for "start=>20030201". Otherwise it would not find > an answer. > > The "20030201" value is found by applying a truncation on > the 20

Re: DateTime-Set.pm

2003-03-07 Thread fglock
Dave Rolsky wrote: > The level of truncation needed can be calculated pretty easily. Yes, if I have a recurrence string (like RFC2445 recurrences). But I don't see how to calculate it from a piece of callback code that could be specifying things so widely variable, from milliseconds up

Re: DateTime-Set.pm

2003-03-07 Thread Dave Rolsky
On Fri, 7 Mar 2003, fglock wrote: > An example, using a "monthly" recurrence: > > # $set = 20030205 until 20030606 > # $recurr_months = months, from -inf until inf > # > print $set->intersection( $recurr_months ); > # output: 20030301, 20030401, 20030501, 20030601 > > Although $recurr_mo

Re: DateTime-Set.pm

2003-03-07 Thread fglock
Dave Rolsky wrote: > On Thu, 6 Mar 2003, fglock wrote: > > What about this (see my other e-mail): > > > > $days = DateTime::Set->new( recurrence => sub { $_[0]->add( days => 1 > > ) }, > > start => NEG_INFINITY, > >); > > Show me how this

Re: DateTime-Set.pm

2003-03-07 Thread Dave Rolsky
On Thu, 6 Mar 2003, fglock wrote: > What about this (see my other e-mail): > > $days = DateTime::Set->new( recurrence => sub { $_[0]->add( days => 1 > ) }, > start => NEG_INFINITY, >); Show me how this would be used. > (as I see it, we _

Re: DateTime-Set.pm

2003-03-05 Thread fglock
Dave Rolsky wrote: > you're using methods from Set::Infinite that are either > under-documented or not documented at all. It would have been too difficult to write those functions whithout using some "low-level" code. Maybe I should include an "INTERNALS" section in Set::Infinite pod, to help