import { IterableX } from './iterablex' ; class GenerateIterable < TState , TResult > extends IterableX < TResult > { private _initialState : TState ; private _condition : ( value : TState ) => boolean ; private _iterate : ( value : TState ) => TState ; private _resultSelector : ( value : TState ) => TResult ; constructor ( initialState , condition , iterate , resultSelector ) { super ( ) ; this . _initialState = initialState ; this . _condition = condition ; this . _iterate = iterate ; this . _resultSelector = resultSelector ; } * [ Symbol . iterator ] ( ) { for ( let i = this . _initialState ; this . _condition ( i ) ; i = this . _iterate ( i ) ) { yield this . _resultSelector ( i ) ; } } } template TState template TResult param { TState } initialState param { ( ( value : TState ) => boolean ) } condition param { ( ( value : TState ) => TState ) } iterate param { ( ( value : TState ) => TResult ) } resultSelector returns { IterableX < TResult > } export function generate < TState , TResult > ( initialState , condition , iterate , resultSelector ) { return new GenerateIterable < TState , TResult > ( initialState , condition , iterate , resultSelector ) ; }