-
Notifications
You must be signed in to change notification settings - Fork 1
map$
Subhajit Sahu edited this page Dec 2, 2022
·
17 revisions
Transform values of a set.
Alternatives: map, map$.
Similar: map, reduce, filter, filterAt, reject, rejectAt.
function map$(x, fm)
// x: a set (updated)
// fm: map function (v, v, x)
const set = require('extra-set');
var x = new Set([1, 2, 3, 4]);
set.map$(x, v => v * 2);
// → Set(4) { 2, 4, 6, 8 }
x;
// → Set(4) { 2, 4, 6, 8 }