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

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).
Well in functional languages a simple way to do it would be to throw an exception when want to exit recursion (maybe not in weird languages like Haskell). So maybe consider just dying inside the callback when you're done with it, and catch with eval.
  • Comment on Re: An iterator for (not "iterating") a recursive data structure.