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]; }
        );
    }
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]; }
        );
    }
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 ] ; } ) ; }
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
returns a collector to calculate an average for all the given elements