Coroutines (generator based)

Intent
Abstract out naturally parrallel evaluation
Motivation
Merge two functional streams
Implementation
The coroutines can be implemented using generators. The example shows an example application
Examples
//if gen and gen2 are generators
function merge_data() {
  try {
    do {
      $data[] = 10*gen() + 5 + 4*gen2();
      ...
    } while( some_condition( ... ) );
  } catch ( $e ) { .... }
  return $data;
}
Powered by Drupal, an open source content management system