The Racket repository
![]() 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 |
||
---|---|---|
collects | ||
doc | ||
man/man1 | ||
src |