-
Notifications
You must be signed in to change notification settings - Fork 0
reduce
Subhajit Sahu edited this page Dec 28, 2022
·
15 revisions
Reduce values of entries to a single value.
function reduce(x, fr, acc?)
// x: ilists
// fr: reduce function (acc, v, k, x)
// acc: initial value
const xilists = require('extra-ilists');
var x = [['a', 'b', 'c', 'd'], [1, 2, 3, 4]];
xilists.reduce(x, (acc, v) => acc+v);
// → 10
xilists.reduce(x, (acc, v) => acc+v, 100);
// → 110