Apply a function to a list (map)
Apply a function to every element of a list.
How to write it
map(f, list)
- f
- The function to apply. Takes a function.
- list
- The elements to apply it to. Takes a list.
Examples
map(x => x^2, [1, 2, 3])In the solver,
Open in the solvermap(x => x^2, [1, 2, 3])gives[1, 4, 9].