in reply to Re^6: Using lazy list with a for loop
in thread Using lazy list with a for loop

depending on your use cases, yes.

for instance you could bind the iterator to the code-line where it is first invoked like available via caller

the next question is if the iterator needs to be destroyed because you leave the loop via last. otherwise an inner loop wouldn't notice if it is reentered.

For instance, an (IMHO extreme) requirement would be to properly support redo

In order to cover all use cases you would need

for (my $iter = create(...); my ($value) = $iter->get(); $iter->inc() +) { ...BODY... }

as I said, not easy.

Cheers Rolf
(addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
Wikisyntax for the Monastery