Takes function and applies it to each element in a list
f /@ {a, b, c} Out[267]= {f[a], f[b], f[c]} (1 + g[#1] & ) /@ {a, b, c} Out[268]= {1 + g[a], 1 + g[b], 1 + g[c]} f /@ {a, b, c} Out[269]= {f[a], f[b], f[c]}
Use when function needs to be called with arguments taken from more than one list, else use Map if argument come from one list
Thread[f[{a, b, c}]] Out[270]= {f[a], f[b], f[c]} f /@ {a, b, c} Out[271]= {f[a], f[b], f[c]} Thread[f[{a, b, c}, {1, 2, 3}]] Out[272]= {f[a, 1], f[b, 2], f[c, 3]}
MapThread[f, {{a, b, c}, {1, 2, 3}}] Out[273]= {f[a, 1], f[b, 2], f[c, 3]}
In this case gives the same answer as using Thread
Thread[f[{a1, a2, a3}, {b1, b2, b3}]] Out[274]= {f[a1, b1], f[a2, b2], f[a3, b3]}
This is only when the lists are one level. For 2 levels we have to use MapThread. This shows the diļ¬erence
MapThread[f, {{{a, b}, {c, d}}, {{1, 2}, {3, 4}}}] Out[275]= {f[{a, b}, {1, 2}], f[{c, d}, {3, 4}]} Thread[f[{{{a, b}, {c, d}}, {{1, 2}, {3, 4}}}]] Out[276]= {f[{{a, b}, {c, d}}], f[{{1, 2}, {3, 4}}]}