Threading a list of functions over a list of arguments
Consider Through
:
Through[{Foo, Goo, Hoo} @@ {a, b, c}]
{Foo[a, b, c], Goo[a, b, c], Hoo[a, b, c]}
Alternatively, use it as:
Through @ {Foo, Goo, Hoo}[a, b, c]
{Foo[a, b, c], Goo[a, b, c], Hoo[a, b, c]}
Or make it into a function:
boohoo = Through[# @@ #2] &;
{Foo, Goo, Hoo} ~ boohoo ~ {a, b, c}
{Foo[a, b, c], Goo[a, b, c], Hoo[a, b, c]}
func={Foo,Goo,Hoo};
arg={a,b,c};
#@@arg&/@func
{Foo[a,b,c],Goo[a,b,c],Hoo[a,b,c]}
Let me know if you need an explanation. I figure a list of both functions and arguments would be the simplest method. Then I just made sure the Map
over the functions would cause them to Apply
to the arguments.