WLJS LogoWLJS Notebook

Map

Map[f, expr] or f /@ expr applies f to each element on the first level in expr.

Map[f, expr, levelspec] applies f to parts of expr specified by levelspec.

Map[f] represents an operator form of Map that can be applied to an expression.

Examples

Apply a function to each element:

Map[f, {a, b, c}]
(* {f[a], f[b], f[c]} *)

Using the shorthand notation:

Sqrt /@ {1, 4, 9, 16}
(* {1, 2, 3, 4} *)

Please visit the official Wolfram Language Reference for more details.

On this page