 | GeneratorIterateTSource Method (TSource, TSource, TSource, TSource, FuncTSource, TSource, TSource, TSource, TSource) |
Makes a generator that uses an iterator function to generate elements.
Namespace:
Gamelogic.Extensions.Algorithms
Assembly:
Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntaxpublic static IGenerator<TSource> Iterate<TSource>(
TSource initialElement0,
TSource initialElement1,
TSource initialElement2,
TSource initialElement3,
Func<TSource, TSource, TSource, TSource, TSource> iterator
)
Parameters
- initialElement0
- Type: TSource
The first element to generate. - initialElement1
- Type: TSource
The second element to generate. - initialElement2
- Type: TSource
The third element to generate. - initialElement3
- Type: TSource
The fourth element to generate. - iterator
- Type: SystemFuncTSource, TSource, TSource, TSource, TSource
The iterator function.
Type Parameters
- TSource
- The type of the t source.
Return Value
Type:
IGeneratorTSource
Exceptions
RemarksThe iterator function is applied the last four items generated to produce the next one.
The first four elements are provided by the caller.
For example,
Iterate(0, 0, 0, 1, (x, y, z, w) => x + y + w + z);
make a generator that produces the Tetranacci numbers.
See Also