23 · Concurrency
Lazy generator delegation
yield ... child delegates one yielded value at a time and retains the child cursor between resumes. It does not materialize an array. Closing the outer generator closes the active child and runs its cleanup; ordinary yield is unchanged.
On this page
yield ... child delegates one yielded value at a time and retains the child cursor between resumes. It does not materialize an array. Closing the outer generator closes the active child and runs its cleanup; ordinary yield is unchanged.
Complete example
Lazy generator delegation.
generator_delegation.zolo
fn* middle()->int{yield 2;yield 3}
fn* values()->int{yield 1;yield ... middle();yield 4}
for value in values(){print(value)}
Rules and behavior
Parallel tasks and deadlines · Documentation
From a checkout of the repository:
zolo examples/features/generator_delegation.zolo
See also