Apply

Apply[f, e] (f@@e) replaces the head of expression e with f.

Attributes[Apply] := {Protected}

Simple examples

In[1]:= Apply[bar, foo[syma, symb]]
Out[1]= bar[syma, symb]
In[2]:= Apply[bar, foo[syma, symb]]
Out[2]= bar[syma, symb]
In[3]:= Apply[List, syma + symb]
Out[3]= {syma, symb}

Apply is useful in performing aggregations on Lists:

In[4]:= Apply[Times, {2, 6}]
Out[4]= 12
In[5]:= Apply[Times, {a, b}]
Out[5]= a*b

Further examples

Apply has no effect on atoms:

In[1]:= Apply[foo, 1]
Out[1]= 1
In[2]:= Apply[foo, bar]
Out[2]= bar