Does the function Map (/@) is equivalent to Apply to first level (@@@) ?
he way that I see this head functions are that both are equivalent. Please, comment if they have a fundamental difference.
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this community
f /@ g[h[1], h[2], h[3]]
andf @@@ g[h[1], h[2], h[3]]
to see the difference :) Remember,Map
wraps functions around stuff, whileApply
replaces the heads of stuff. $\endgroup$f @@@ {{1,2},{x,y}}
andf /@ {{1,2}, {x,y}}
. Is the result the same or different? Remember that it's not necessary to definef
to do this (in fact you shouldn't define it to really see what's happening). $\endgroup$f /@ list
maps a functionf
onto each element oflist
, solist
is a set of arguments on whichf
will be evaluated.f @@@ list
replaces theHead
of each level-1 element inlist
. $\endgroup$f@@@lst
as being a shorthand forf @@ # & /@ lst
. That is, we may think of Apply at level one as being equivalent to mapping Apply to each (level one) element of lst. Perhaps this is what you mean?f @@ # & /@ {{1, 2}, {x, y}} == f @@@ {{1, 2}, {x, y}}
$\endgroup$