Created
October 15, 2012 21:58
-
-
Save refractalize/3895835 to your computer and use it in GitHub Desktop.
Continuations in Pogoscript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.current (callback) = | |
continuation () = | |
callback (nil, continuation) | |
callback (nil, continuation) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
continuations = require './continuations' | |
n = 0 | |
next = continuations.current! () | |
n = n + 1 | |
console.log (n) | |
if (n < 10) | |
next () |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment