Re: Question: Applying a list of funcs to a list of expressions
- To: mathgroup at smc.vnet.net
- Subject: [mg2944] Re: Question: Applying a list of funcs to a list of expressions
- From: jsobel at sdav01.seinf.abb.se (Jarl R Sobel)
- Date: Sat, 13 Jan 1996 03:21:32 -0500
- Organization: ABB Industrial Systems
In article <4d20el$ejt at dragonfly.wri.com>, groskyd at gv.ssi1.com (David
Rosky) wrote:
> I would like to specify a list of functions such as:
>
> funcs = {f1, f2, f3}
>
> and a list of values to which the functions will be
> applied:
>
> vals = {val1, val2, val3}
>
> I would then like to apply to each function to each corresponding value
> respectively to obtain the following list:
>
> DesiredOutputList = {f1[val1], f2[val2], f3[val3]}
>
What about:
In[1]:=
funcs = {f1,f2,f3};
vals = {val1,val2,val3};
In[2]:=
MapThread[Apply[#1,{#2}]&,{funcs,vals}]
Out[2]=
{f1[val1], f2[val2], f3[val3]}
Regards
Jarl R Sobel
==== [MESSAGE SEPARATOR] ====