Reinhold May wrote: > > Flavio, I haven't tried that yet, but from my > understanding, these code excerpts don't solve > my problem. I guess, your question was > directed into this possiblity: > > My problem refers to SpanSets derived from sets > of recurrences, which I can't imagine to be > internally represented as lists (in > fact, I know thy're not, but I can't quite figure > out yet how they are represented) but must be > represented as some kind of generic structure. >
A "infinite recurrence" is stored as a reference to a subroutine (there are actually 3 closures in each recurrence). This is managed by the Set::Infinite::_recurrence module. You can see the internal data structure by running this: --- use DateTime::Event::Recurrence; use DateTime::SpanSet; use Data::Dumper; use strict; my $dt_set1 = DateTime::Event::Recurrence->daily; my $dt_set2 = $dt_set1->clone->add( hours => 12 ); my $spanset = DateTime::SpanSet->from_sets ( start_set => $dt_set1, end_set => $dt_set2 ); print "DateTime::Set\n\n"; print Dumper ( $dt_set1 ); print "\n\nDateTime::SpanSet\n\n"; print Dumper( $spanset ); --- The "recurrence" is the part that says: 'param' => [ sub { ... sub { ... sub { ... ], See also: http://search.cpan.org/~fglock/Set-Infinite- 0.55/lib/Set/Infinite.pm#INTERNALS > So my question really is: is a recurrence set > that is used to create a SpanSet preserved in > that SpanSet? If so, can I extract it? > I don't think it is advisable to do that. Note that the data structure becomes much more complex as you start doing operations like union/intersection/complement/... > To get the list contents, I could imagine this > code to work quite well with the existing API > functions: > > my @list; > foreach my $span ($spanset->as_list()) { > push(@list, $span->start()); > } > my $start_set = DateTime::Set->from_datetimes( > datetimes => [EMAIL PROTECTED] > ); > It doesn't work with unbounded recurrences, because as_list() will refuse to generate an infinite array. But this is fine with bounded sets. - Flavio S. Glock