Re: Applying List of Functions To List Of Arguments
- To: mathgroup at smc.vnet.net
- Subject: [mg30184] Re: [mg30181] Applying List of Functions To List Of Arguments
- From: Adriano Pascoletti <pascolet at dimi.uniud.it>
- Date: Thu, 2 Aug 2001 03:15:42 -0400 (EDT)
- References: <200108010619.CAA03973@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
At 2:19 -0400 1-08-2001, Ronnen Levinson wrote:
>Hi.
>
>What function or operator will let me apply a list of functions to a
>list of arguments? That is, I'd like to apply {f1,f2,f3} to {a,b,c} to
>get {f1[a],f2[b],f3[c]}.
>
>Yours truly,
>
>Ronnen.
In[3]:=
#[[1]]@#[[2]]&/@Transpose[{{f1,f2,f3},{a,b,c}}]
Out[3]=
{f1[a],f2[b],f3[c]}
A shorter and faster solution is
In[4]:=
MapThread[#1@#2&,{{f1,f2,f3},{a,b,c}}]
Out[4]=
{f1[a],f2[b],f3[c]}
Adriano Pascoletti