Aktuelle Änderungen Printable View Änderungen Bearbeiten
Smalltalk > ClojureVs > ScottMckay > CommonLisp > Lisp > LightPress > ScreenCast > PaulGraham > RichHickey > InterMap > EuroPython > ModRewrite > Htaccess > WebService > WebServices > Conditions > CoRoutinesClear TrailCoroutines are functions or procedures that save control state between calls (as opposed to, but very similar to, Generators, such as Random Number Generators, that save data state between calls). The most common example is a lexical analyser that behaves differently on different calls because it is tracking e.g. whether it is currently inside a function definition or outside a function definition.
In computer science, coroutines are program components that generalize subroutines to allow multiple entry points and suspending and resuming of execution at certain locations.[1]
Generators also become coroutines, a more generalized form of subroutines. Subroutines are entered at one point and exited at another point (the top of the function, and a return statement), but coroutines can be entered, exited, and resumed at many different points (the yield statements).[2]
Coroutines are used in operating systems, compilers, discrete-event simulation programs, text manipulation, artificial intelligence, sorting, and numerical analysis programs. These applications can require several activities to be executing at the same time and values to be transferred between processes.[3]