Name: Anonymous 2005-12-21 8:09
Because I'm learning it, almost done through the tutorial, and it looks great.
shift/reset primitives in your Lispy language of choice, how would you implement (make-generator f) such that:(define g
(make-generator
(lambda (yield)
(map yield '(1 2 3 4 5)))))
(g) ; should print 1
(g) ; should print 2
(g) ; should print 3call/cc. I was asking for how to do it using delimited continuations, more specifically, using shift/reset. Since delimited continuations may be used to implement call/cc, it comes as no surprise that (make-generator f) may be implemented using delimited continuations. However, I would like to know the most natural way of doing it, preferably without wrapping the code in a reset (which would amount to emulating call/cc, which involves an unfortunate copying of the entire stack).