This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Documentation / Mathematica / Built-in Functions / Programming / Functional Programming /

Apply

FilledSmallSquare Apply[f, expr] or f @@ expr replaces the head of expr by f.

FilledSmallSquare Apply[f, expr, levelspec] replaces heads in parts of expr specified by levelspec.

FilledSmallSquare Examples: Apply[f, a, b, c] LongRightArrow; Apply[Plus, g[a, b]] LongRightArrow.

FilledSmallSquare Level specifications are described in Section A.3.6.

FilledSmallSquare The default value for levelspec in Apply is {0}.

FilledSmallSquare f @@@ expr is equivalent to Apply[f, expr, 1].

FilledSmallSquare Examples: Apply[f, a,b,c,d] LongRightArrow.

FilledSmallSquare Apply[f, a,b,c,d, 1] LongRightArrow.

FilledSmallSquare Apply[f, a, -2] LongRightArrow.

FilledSmallSquare Apply operates on SparseArray objects just as it would on the corresponding ordinary lists.

FilledSmallSquare See Section 2.2.3.

FilledSmallSquare See also: Map, Scan, Level, Operate, MapThread, Total.

FilledSmallSquare New in Version 1; modified in 4.0.

Further Examples