Flavio S. Glock wrote:
> Sets of type 4 are 'huge sets'. These have an 'unknown' count. The
count
> can be thousands or even millions of dates, but it is not infinite.

- or two or three -

> Before version 0.10, you would run out of memory if you specified
> something like "all seconds in the century".
> Now, the program will just go on normally - it creates a 'huge set'.
And
> it doesn't attempt to count the set elements.

Would there be some way we could 'guess' if it's loo large to count? Or
maybe if a count is requested, we count 10,000 and then return undef if
there's more?

I'm thinking there would be a lot of recurrences such as 'every tuesday'
with restraints such as 'in 2003'. This is easily countable and probably
useful.

The 'guess' part would be to look at the recurrence and check it's
'density'. With the occurrence above, the density is 1/week. Given a
start and end date, we could calculate this for a large number of years.
Lets say this module doesn't return counts over 10,000. We build in
yearly guestimates for our density denominators. The week guestimate is
52. So we can count the elements for (range as years in float)/52
recurrences.

If we have a recurrence of 'every second' then the yearly guestimate is
60*60*24*356.25. Now we can take our (range as years in float) and
divide it by our yearly guestimate. If the result is over 10,000 we
return undef.

While all this is a heap of code, we can quickly see if it's worth
counting the actual occurrences.

ALSO If we go this path or not, I'd prefer not to get plain undef back.
I'd like an indication that it was 'too hard to count', or that it was
'over 10,000'.

Cheers!
Rick

Reply via email to