fromInvocation - nodef/extra-iterable GitHub Wiki

Generate iterable from repeated function invocation.

Alternatives: from, fromIterator, fromRange, fromInvocation, fromApplication. Similar: toInvokable, fromInvocation.

function fromInvocation(fn, ...args)
// fn:   function (impure)
// args: arguments
const xiterable = require('extra-iterable');

var x = xiterable.fromInvocation(Math.random);
[...xiterable.take(x, 4)];
// → [
//   0.9563611116619364,
//   0.9938159365212336,
//   0.38494305694810205,
//   0.06828624643528514
//]

References