We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Perform inclusive prefix scan from left to right!
Alternatives: inclusiveScan, inclusiveScan$. Similar: inclusiveScan, exclusiveScan.
function inclusiveScan$(x, fr, acc) // x: an array (updated!) // fr: reduce function (acc, v, i, x) // acc: initial value
const xarray = require('extra-array'); var x = [1, 2, 3, 4, 5]; xarray.inclusiveScan$(x, (acc, v) => acc+v, 0); // → [ 1, 3, 6, 10, 15 ] (x modified!) var x = [1, 2, 3, 4, 5]; xarray.inclusiveScan$(x, (acc, v) => acc+v, 10); // → [ 11, 13, 16, 20, 25 ] (x modified!)