Skip to content

Instantly share code, notes, and snippets.

@Lovesan
Created March 27, 2020 08:37
Show Gist options
  • Save Lovesan/18f3a5f7553531576c90de64adef2801 to your computer and use it in GitHub Desktop.
Save Lovesan/18f3a5f7553531576c90de64adef2801 to your computer and use it in GitHub Desktop.
call/ec implemented in JS
function call_ec(f) {
var tag = new EvalError('Continuation block no loger exists');
try {
f(function(rv) {
tag.rv = rv;
throw tag;
});
} catch(obj) {
if(obj === tag) {
return tag.rv;
}
throw obj;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment