|
|
| No such thing as a small change | |
| PerlMonks |
Re: Recursively-generated Iteratorsby runrig (Abbot) |
| on May 20, 2005 at 04:39 UTC ( #458851=note: print w/ replies, xml ) | Need Help?? |
|
I had my own idea of how to do it, and I came up with restartable iterators:
In the append iterator, when the second iterator is exhausted, it causes the first iterator to iterate, and then restarts the second iterator at the appropriate starting point. Update:Unlike the other solutions, the solution above returns an array of indices instead of a set of elements from a list, but that's easy to adjust:
Update: Simplified code. Which may or may not be a good thing :-)
In Section
Meditations
|
|
||||||||||||||||||||||||