Internal
Initial value
Function to apply to the previous value to get the next value
A new generator that yields the value
n
times.
const gen = iterate(1, (x) => x * 2);
console.log([...take(gen, 5)]); // [1, 2, 4, 8, 16]
Generated using TypeDoc
Create a new generator that yields values generated by applying the function to the previous value starting with the initial value.