My example perl6 code is wrong (and gives the correct answer by accident); and gather/take aren't exactly coroutines although I see that someone's created a "coro/yield" module at https://github.com/marcoonroad/Coro-Simple/
I have some more reading and thinking to do...