2 ms·
> I demonstrate how to (ab)use generators/coroutines to transform any recursive function into an iterative function with nearly zero code changes. That's not
by wahern 5y ago
> I demonstrate how to (ab)use generators/coroutines to transform any recursive function into an iterative function with nearly zero code changes.
That's not abuse. Reversing consumer/producer calling protocols (i.e. reversing caller/callee relationship) is exactly the fundamental purpose of generators and coroutines. It's a useful insight, nonetheless, for those exploring the fundamental problem and solution space regarding concurrency and, more generally, the reification of execution flow.