Skip to content

Instantly share code, notes, and snippets.

View kbloom's full-sized avatar

Ken Bloom kbloom

View GitHub Profile
import scala.util.continuations._
class Generator[A] extends Iterator[A] with (A => Unit @ suspendable) {
private var a: Option[A] = None
private var k: Option[Unit => Unit] = None
def next = {
val a0 = a.get
val k0 = k.get
a = None