Marcin Kosiba wrote:
Hi,
To illustrate what I meant I'm attaching two examples. In example_1.py I've written code the way I think would be elegant (but it doesn't work). In example_2.py I've written code so that it works, but it isn't elegant. I know I'm abusing Python iterators here. Also, I'm not sure the way to compose iterators shown in example_2.py is the only option. Actually I'd love to see a better solution, because it would remove a lot of bloat from my code ;)


You may want to look at Lua coroutines, which are more powerful than Python iterators. Your example_1.py is very similiar to the example in the Coroutines Tutorial [1].

[1] http://lua-users.org/wiki/CoroutinesTutorial

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to