Fuzion Logo
flang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.


Coroutines basically provide a means for a function to yield a sequence of results in the middle of the function, instead of just one result at the end. This can be used for lazy generation of results.

Coroutines are hence somewhat similar to streams, where the state of the stream includes the position of the yield of the last value in addition to the state of all fields of the stream instance.

Applications of Coroutines

TBW: It is unclear to me what the main application of coroutines is, where do they provide a real benefit over streams?

Implementation of Coroutines

Any non-recursive coroutine can be mapped to a stream by performing these steps:

TBD: Do recursive co-routines make any sense?