|Keep It Simple, Stupid|
An iterator for (not "iterating") a recursive data structure.by BrowserUk (Pope)
|on Feb 12, 2015 at 13:20 UTC||Need Help??|
BrowserUk has asked for the wisdom of the Perl Monks concerning the following question:
If you have a recursive data structure -- say an AoA[oA[oA]...]] -- and you want to iterate over the leaves; then the typical Perl solution is a recursive callback iterator something like this:
Which is fine unless you need to be able to quit the iteration at an arbitrary point. (ie. short circuit rather completing the full iteration).
What I need is an iterative iterator for a recursive data structure. What I've got so far is this:
But my mind's gone blank. Any offers for how to fill the blank?
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I'm with torvalds on this
In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked