Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

What's bad about Python?

Name: Anonymous 2005-12-21 8:09

Because I'm learning it, almost done through the tutorial, and it looks great.

Name: Anonymous 2011-07-26 22:55

>>101,112
Sorry for bothering you again (and for bumping this awful thread), but I would like to ask you something.  If given the 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 3


It's been haunting me for days now.

Name: Anonymous 2011-07-27 2:34

>>203
I know how to do it using regular call/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).

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List