# What is happening in Map[Function[x, x^2], a + b + c] from the Pure Function tutorial

The Pure Function tutorial gives an example: Map[Function[x, x^2], a + b + c].

I would expect the output to be (a + b + c)^2, but instead it returns a^2 + b^2 + c^2. Map[Function[x,x^2],a+b+c]//FullForm even gives Plus[Power[a,2],Power[b,2],Power[c,2]] which provides no clarity. What's going on here?

-

Whoa, trippy! Map[#+1&,f[A[x]+B[x]]+g[A[x]+B[x]],2] $\to$ 2+f[1+A[x]+B[x]]+g[1+A[x]+B[x]]. Why didn't I end up with 2+A[x]+B[x] inside f and g? It mapped into the Plus[f,g] twice (once for f and once for g), but it only mapped into the Plus[A,B] at level two once? For which one, A or B? – Travis Bemrose Apr 14 '14 at 10:14
@TravisBemrose because the heads at the second level are f and g so map does f[whatever]$\rightarrow$f[1+whatever]. At the third level the head is Plus. You can replace TreeForm for my FullForm to see the level hierarchy more clearly – gpap Apr 14 '14 at 11:01