-
Notifications
You must be signed in to change notification settings - Fork 5
map$
Subhajit Sahu edited this page Nov 20, 2022
·
27 revisions
Transform values of an array.
Alternatives: map, map$.
Similar: map, filter, reject, reduce, accumulate.
function map$(x, fm)
// x: an array (updated)
// fm: map function (v, i, x)
const array = require('extra-array');
var x = [1, 2, 3, 4];
array.map$(x, v => v * 2);
// → [ 2, 4, 6, 8 ]
x;
// → [ 2, 4, 6, 8 ]