The Racket repository
Go to file
Eli Barzilay 505034ea26 The generator function can now be used to send values to the generator.
For example,

  (define g (generator (yield (yield (yield 1)))))
  (list (g) (g 2) (g 3) (g 4) (g) (g))

evaluates to '(1 2 3 4 4 4).  This is something that Python does (as a
generator.send method), which might be useful for using generators as
co-routines, and it is actually easy to implement since sending values
is exactly what we get when the generator call is actually calling the
saved continuation.  So most of the change is dealing with the
technicalities of throwing an error when the generator is called with
some arguments, when that's done after it's terminated (at the stage
where it's repeating the last value for ever).

A few tests added for this.

svn: r17979
2010-02-05 03:22:01 +00:00
collects The generator function can now be used to send values to the generator. 2010-02-05 03:22:01 +00:00
doc A bunch of additional typos 2010-02-05 03:21:52 +00:00
man/man1 2009 -> 2010 2009-12-22 05:52:15 +00:00
src A bunch of additional typos 2010-02-05 03:21:52 +00:00