[plt-scheme] purely function call/cc example

From: Eli Barzilay (eli at barzilay.org)
Date: Wed Feb 3 09:40:11 EST 2010

On Feb  3, Francesco Abbate wrote:
> Python feature the 'yield' keyword that allows to create very easily
> coroutines and use them in a for loop. I understood that scheme
> allows this kind of programming with call/cc but it seems to me that
> it does require a significant amout of boiler-plate code and I was
> wondering if there is a short direct syntax similar to the 'yield'
> of Python.

(require scheme/generator)
(define foo (generator (yield 1) (yield 2) (yield 3)))

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the users mailing list.