 |
Apply
Apply[
f
,
expr
] or f
@@
expr replaces the head of expr by f. Apply[
f
,
expr
,
levelspec
] replaces heads in parts of expr specified by levelspec.
Examples: Apply[f,
a, b, c
] ; Apply[Plus, g[a, b]] . Level specifications are described in Section A.3.6. The default value for levelspec in Apply is {0}. Examples: Apply[f,
a,b
,
c,d
] . Apply[f,
a,b
,
c,d
,
1
] . Apply[f,
a
, -2] . See the Mathematica book: Section 1.8.11, Section 2.2.3. See also: Map, Scan, Level, Operate, MapThread.
Further Examples
This substitutes New for Old at the head of the expression using the shorthand notation for Apply. (Neither New nor Old has a built-in meaning in Mathematica.)
In[1]:= 
Out[1]= 
The head of a product is Times; the head of a list is List. (You can see heads explicitly using FullForm[].)
In[2]:= 
Out[2]= 
This changes a line into a polygon.
In[3]:= 
Out[3]= 
This constructs a list of circles from a list of pairs of centers and radii.
In[4]:= 
Out[4]= 
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT. SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION. | | | |
 | |
|