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 would be used.

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_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 20030205 value.

If you do not provide a "truncator", I have to disable the
equation solver and the program will have to iterate from
"start" to whatever date you need, even if that date
is a million years later.

- Flavio Soibelmann Glock

Reply via email to