Heya, inspired by the coroutines for Go-article, I thought that one good usage for coroutines would be turning push-iteration into pull-iteration (sequence + yield -> iterator).
However, my naive approach runs into the problem that
SequenceScope
is restricted suspension scope and thus I cannot use the recursive approach defined there.
In short, I'd like to turn this recursive approach into a iterator without manually writing the stack handling for such an iterator.
Is there a way to do this?
s
Sam
12/11/2023, 2:48 PM
This is weirdly similar to the previous question 😄
j
Jarkko Miettinen
12/11/2023, 2:49 PM
Yeah, now that I read the thread there's clear overlap.
I could write that with a Flow, but turning that into an Iterator (without copying all content over) seems hard to me.