Map a set in mathematical notation

122 Views Asked by At

How would express the following JavaScript which takes a set and applies a lambda to each member of the set (resulting in a new set) in mathematical notation?

var set = [1, 2, 3];
var set2 = set.map(function(n){
 return n * 2;
}); 

set2 === [2, 4, 6]; // true
1

There are 1 best solutions below

1
On

Trying to keep in the spirit of your question, how about $$A = \{1, 2, 3\}$$ $$B = \{x^2 \, | \, x \in A\}$$