Learning how to program I dont fully get the difference of /@ vs @
l = Table[n (n + 1) (n + 2) (n + 3), {n, 1, 10}]
{24, 120, 360, 840, 1680, 3024, 5040, 7920, 11880, 17160}
Sqrt[l + 1]
{5, 11, 19, 29, 41, 55, 71, 89, 109, 131}
Trying to obtain the same result
a = (#^(1/2)) &@ (# + 1) & /@ l
{5, 11, 19, 29, 41, 55, 71, 89, 109, 131}
b = (#^(1/2)) & /@ (# + 1) & /@ l
{25, 121, 361, 841, 1681, 3025, 5041, 7921, 11881, 17161}
c = (#^(1/2)) & /@ (# + 1) & @ l
{5, 11, 19, 29, 41, 55, 71, 89, 109, 131}
The way I understand /@ is to apply the function to every item of the list, so not sure why I get different results on a, b, c. Particularly why in b the function (#^(1/2)) &
is not evaluated at all
Sqrt[# + 1] & /@ l
$\endgroup$