Map
Map
Map[ x->f(x), list ] applies a given function or mapping to each element of a given list.
Usages
Map[x->expr, list]
Map[x->expr, list] applies the mapping x->expr to each element of list.
| Example | in | out |
|---|---|---|
The mapping x->x^2 applied to each element of {2,3,4} |
Map[ x-> x^2, {2,3,4} ] |
{ 4, 9, 16 } |
Map[func, list]
Map[func, list] applies the mapping x -> func[x] to each element of list.
| Example | in | out |
|---|---|---|
The function sqrt applied to each element of {2,3,4} |
Map[ sqrt, {2,3,4} ] |
{ sqrt[2], sqrt[3], sqrt[4] } |