[Haskell-cafe] Laziness enhances composability: an example
marcin.kosiba at gmail.com
Thu Jul 9 15:29:40 EDT 2009
On Thursday 09 July 2009, Cristiano Paris wrote:
> Thanks. In fact, I was stuck trying to find an example which couldn't
> be written using Python's iterators. The only difference coming up to
> my mind was that Haskell's lists are a more natural way to express a
> program relying on laziness. That was the reason why added the clause
> "at least not elegantly" in my first post.
I recently tried writing some code to simulate a certain protocol in Python.
I thought I'll go the "smart" way and rely on the Python yield construct to
do a CPS transformation of my code.
While this worked to a certain extent, composability was a problem, because
any sub-procedure which used yield (and thus was an iterator) required being
called in a rather inelegant way.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20090709/4eee009c/attachment.bin
More information about the Haskell-Cafe