Skip to content

Instantly share code, notes, and snippets.

@mlhaufe
mlhaufe / delimited-continuations.js
Created July 13, 2023 21:41 — forked from yelouafi/delimited-continuations.js
delimited continuations using javascript generators
// We model the call stack using a linked list of Generators
// Each Generator has a _return field pointing back to its parent
function stepGen(gen, arg) {
const {done, value} = gen.next(arg)
if(done) {
if(gen._return) {
stepGen(gen._return, value)
}