-
Notifications
You must be signed in to change notification settings - Fork 5
fromApplication
Subhajit Sahu edited this page May 3, 2023
·
3 revisions
Generate array from repeated function application.
Alternatives: from, from$.
Similar: from, fromRange, fromInvocation, fromApplication.
function fromApplication(fm, v, n)
// fm: map function (v, i)
// v: start value
// n: number of values
const xarray = require('extra-array');
xarray.fromApplication(v => v+2, 2, 4);
// → [ 2, 4, 6, 8 ]
xarray.fromApplication(v => v*2, 2, 4);
// → [ 2, 4, 8, 16 ]