in reply to Acceleration ETA algorithm

> And yes, it would be better to extract the state components into an object

I think it's easier (and better) rewritten in functional style with a generator function returning the ETA closure function.

Most of your states would be my-vars in the outer generators scope. And you wouldn't need the voodoo to initialize the first run.

This  state $init = do {... } is an interesting trick tho. :)

Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery