in reply to Re: An iterator for (not "iterating") a recursive data structure.
in thread An iterator for (not "iterating") a recursive data structure.

Update 2: Compared to Eily's solution, mine is iterative (non recursive), while Eily's is recursive.
Yup, and my solution generates a lots of closures on the fly. This would probably make it slower on structures that are deeper than they are wide.

Your solution doesn't seem to work though, it goes down the levels alright, but never climbs back up. I'm afraid trying to work on this in an iterative way (I kind of see the idea, and I know it's possible) just confuses the perl out of me, so I can't point out what's wrong.

  • Comment on Re^2: An iterator for (not "iterating") a recursive data structure.

Replies are listed 'Best First'.
Re^3: An iterator for (not "iterating") a recursive data structure.
by MidLifeXis (Monsignor) on Feb 12, 2015 at 14:25 UTC

    See update three - had a bad comparitor that was generating undef in the middle of the data. I was going one beyond the end of the array of data.

    --MidLifeXis