From: Pit Capitain Date: 2003-07-23T07:02:50+09:00 Subject: Re: callcc and insomnia On 22 Jul 2003 at 15:29, Dan Doel wrote: > class Coroutine > (...) > end > > Which lets you write code like this: > > def func(a, b, c) > yield a > yield b > c > end > > cot = Coroutine.new method(:func) > > puts cot.call("mook", "mock", "morn") # => mook > puts cot.call("mush", "milf", "maern") # => mock > puts cot.call("mush", "milf", "maern") # => morn > puts cot.call("mush", "milf", "maern") # => mush > puts cot.call("mush", "milf", "maern") # => milf > puts cot.call("mook", "mock", "morn") # => maern > > Which I was pleased with. Dan, it seems that by calling the "call" method you do two things: 1) push more input values into the coroutine and 2) get the next return value. Is this what you wanted to achieve? Wouldn't it be better to separate those two things? Just interested, Pit