GeneratedSequence
优质
小牛编辑
132浏览
2023-12-01
A GeneratedSequence
does not wrap an in-memory collection but rather determines its elements on-the-fly during iteration according to a generator function.
You create a GeneratedSequence
by calling Lazy.generate.
Signature
function GeneratedSequence(generatorFn, length) { /*...*/ }
function GeneratedSequence(generatorFn, length) { this.get = generatorFn; this.fixedLength = length; }
Name | Type(s) | Description |
---|---|---|
generatorFn | function(number):* | A function which accepts an index and returns a value for the element at that position in the sequence. |
length | number? | The length of the sequence. If this argument is omitted, the sequence will go on forever. |