# Threading a list of functions over a list of arguments

I want to produce {Foo[a,b, c], Goo[a, b, c], Hoo[a, b, c]}. However my attempt below

Thread[Apply[{Foo, Goo, Hoo}, HoldComplete@Sequence[a, b, c]]]

produces {Foo, Goo, Hoo}[a, b, c].

Could you fix it?

• Construct[#, Sequence[a,b,c]] & /@ {Foo, Goo, Hoo} ... or if you want to keep the hold and release: ReleaseHold[Construct[#, HoldComplete@Sequence[x, y, z]] & /@ {Foo, Goo, Hoo}] Commented Jun 11, 2020 at 0:45
• Let me know if my solution would work for you, or how I might improve it :D Commented Jun 11, 2020 at 0:55
• @flinty: Thank you. Commented Jun 11, 2020 at 3:00

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.

• @MoneyOrientedProgrammer glad to hear it! Looks like kglr beat me again though haha D; Commented Jun 11, 2020 at 3:47

Using ComapApply (new in 14.0)

ComapApply[{Foo, Goo, Hoo}] @ {a, b, c}

{Foo[a, b, c], Goo[a, b, c], Hoo[a, b, c]}

As of 2022 we have at our disposal the resource function called ThroughOperator that can do that. This is a development thanks to @Sjoerd Smit.

With

functions = {Foo, Goo, Hoo};
arguments = {a, b, c};

we do

ResourceFunction["ThroughOperator"][functions] @@ arguments

and we get:

{Foo[a, b, c], Goo[a, b, c], Hoo[a, b, c]}

Another way using Thread:

f = Activate[#1 @@@ #2 & @@@ Thread[{#1, Inactive[#2]}]] &;

f @@ {{Foo, Goo, Hoo}, {a, b, c}}

(*{Foo[a, b, c], Goo[a, b, c], Hoo[a, b, c]}*)

Using Query

Query[Apply /@ {Foo, Goo, Hoo}] @ {a, b, c}

{Foo[a, b, c], Goo[a, b, c], Hoo[a, b, c]}