On Thursday 09 July 2009, you wrote: > 2009/7/9 Marcin Kosiba <marcin.kos...@gmail.com>: > > 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. > > i confess to not understanding the inelegance. > can you provide an example where an iterator inside CPS requires > special support?
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 ;) Thanks! Marcin Kosiba
example_1.py
Description: application/python
example_2.py
Description: application/python
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe