[plt-scheme] "Standard" coroutine library suitable for building filters as well as generators

From: Eli Barzilay (eli at barzilay.org)
Date: Mon Apr 5 14:32:30 EDT 2010

On Apr  5, Jon Rafkind wrote:
> On 04/05/2010 12:17 PM, Scott McLoughlin wrote:
> > I think the term is "fully asymmetric" coroutines, but please
> > correct me if I'm wrong.  I'm not look for just Python style
> > generators, but a much more robust coroutine implementation.
> >
> > I'm looking for a fairly "canonical, full" coroutine
> > implementation, where a "yield" like operator can work at
> > activation levels other than just the top level, and where a
> > "yield" style operator can function as both a LHS or RHS operator
> > (or two separate operators), facilitating sending values to a
> > coroutine in a "filter chain" style structured program.
> 
> I'm not exactly sure what you mean by "work at activation levels
> other than just the top level" but the scheme/generator library lets
> you send values back through the `yield' operator.

If you (Scott) mean that you want `yield' to work in any function that
the generator can call out to, then this is exactly one thing that
`scheme/generator' does and python does not -- because just using
`yield' turns the function definition into a generator.

(BTW, note that in svn the `generator' form is different from 4.2.5 --
it requires empty parentheses, as in (generator () ...code...).)

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


Posted on the users mailing list.