3 ms·
If you have a function that can suspend its own execution and return data, you have a Python generator. If it can also receive data when it is resumed, you hav
by anonymoushn 13y ago
If you have a function that can suspend its own execution and return data, you have a Python generator.
If it can also receive data when it is resumed, you have an ES6 generator (or the C macros above!).
If its subroutines can cause it to suspend, you have a full-blown coroutine.
If it can be copied, you can build call/cc.
- _ZeD_ 13y agobut but... http://dabeaz.com/coroutines/ http://dabeaz.com/coroutines/
- anonymoushn 13y agoOops! "Python generator" should be "Python 2.4 generator." Versions of Python people actually use go with ES6.
- 616c 13y agoI had know idea call/cc was that powerful. Very cool, and thanks for the breakdown for someone who did not know the difference.