[Haskell-cafe] Re: Laziness enhances composability: an example

Marcin Kosiba marcin.kosiba at gmail.com
Fri Jul 10 10:55:59 EDT 2009


On Friday 10 July 2009, Gleb Alexeyev wrote:
> 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

That in turn looks similar to Stackless Python[1], which I've been looking 
over recently ;)

[1] http://www.stackless.com/wiki/Channels
Thanks!
	Marcin Kosiba
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20090710/c5df7d62/attachment.bin


More information about the Haskell-Cafe mailing list