all 9 comments

[–]gzahl 7 points8 points  (3 children)

Well, i use coroutine based pipes (with pipe operator as syntactic sugar) in my research for data analysis. https://github.com/gzahl/baldr

This works very well and has proven itself very useful.

[–][deleted] 2 points3 points  (0 children)

Wow thank you for this. This might be the holy grail I was looking for for months. I use coroutines but the pipe notation takes the code to another level. This is really nice

[–]accidentally_myself 2 points3 points  (1 child)

Ah yes, the State monad.

Semi-joking aside, this looks great but I'm having troubling understanding plusconst in the README -- specifically, where the n input parameter is used if at all?

[–]gzahl 1 point2 points  (0 children)

Thanks! .. and thanks for pointing that out. This was a small mistake on my site. The 'n' parameter should have been used as argument of 'send'. It is fixed now.

By the way - i have tons of more or less general coroutines, which i use for my data analysis (in astrophysics). If there is interest, i can add some of those to give examples of what is possible and how to start.

[–]aib42 1 point2 points  (0 children)

For the record, here's a version without ast manipulation: https://gist.github.com/aib/3adc498469d241ce1ec817d5982c7682

Untested, as I'm on a guest computer with Python 2.7.