On Mon, Oct 25, 2021 at 2:31 AM Daphne Preston-Kendal <xxxxxx@nonceword.org> wrote:

I proposed a solution to the first problem: generators become one-argument procedures instead of thunks, and return their single argument, instead of the eof-object, when exhausted.

I don't see that that helps much: a generator still can't return all the objects in the Scheme universe, so converting from lists to generators is still (technically) impossible.  In addition, generator operations become much more complicated: gmap has to be told which end objects to pass to each of its generator arguments, since only the top-level caller knows what objects each argument cannot return as a normal value.

Marc Nieper-Wißkirchen proposed a completely new API of functional iterators as two-argument procedures: (iterator next end), where next is a two-argument procedure receiving a new iterator plus the next item in the sequence, and end is a thunk called when the sequence is exhausted.

That's even more awkward to compose.