original_string: public static function forAverage(callable $num): self {
          return new self(
                  function() { return [0, 0]; },
                  function(&$result, $arg) use($num) { $result[0] += $num($arg); $result[1]++; },
                  function($result) { return $result[0] / $result[1]; }
          );
      }
code: public static function forAverage(callable $num): self {
          return new self(
                  function() { return [0, 0]; },
                  function(&$result, $arg) use($num) { $result[0] += $num($arg); $result[1]++; },
                  function($result) { return $result[0] / $result[1]; }
          );
      }
code_tokens: public static function forAverage ( callable $ num ) : self { return new self ( function ( ) { return [ 0 , 0 ] ; } , function ( & $ result , $ arg ) use ( $ num ) { $ result [ 0 ] += $ num ( $ arg ) ; $ result [ 1 ] ++ ; } , function ( $ result ) { return $ result [ 0 ] / $ result [ 1 ] ; } ) ; }
docstring: returns a collector to calculate an average for all the given elements
  
  @api
  @param   callable  $num  callable which retrieves a number from a given element
  @return  \stubbles\sequence\Collector
docstring_tokens: returns a collector to calculate an average for all the given elements