1

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 Answers1

1

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

Jason Knapp
  • 1,669