For Perl, it is very easy to convert recursive program into its iterator version.
The only thing you need, in order to accomplish this conversion easily, is 'stack'. Perl by default suppots stack in its core, thanks to the ability to pop() and push() against a list.
To convert:
In reply to Re: Turning a recursive function into an iterator
by pg
in thread Turning a recursive function into an iterator
by l3nz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |