MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Applying a list of functions to a list of arguments


Hi Derek,
you may define a function that apply the first argument to the seond 
argument and then use "Inner". E.g.

f[x_, y_] = x[y];
Inner[f, {f1, f2, f3}, {a, b, c}, List]
gives
{f1[a], f2[b], f3[c]}

Sincerely, Daniel

D M Yates wrote:
> I have a list of functions, and a list of arguments:
> 
> For example,
> f = {f1, f2, f3}
> a = {a1,a2,a3}
> 
> I would like to return
> {f1[a1],f2[a2],f3[a3]}
> 
> I thought this should easy, but am stumped. Obviously the lists are of 
> equal, but arbitrary length, and the arguments may or may not be atomic 
> expressions. In my particular case, the arguments are likely to be 
> combinations of Real, and List[Real,...], but I hope this is 
> irrelevant.
> 
> Any suggestions?
> 
> Many thanks,
> 
> Derek Yates
> 


  • Prev by Date: Re: Sorting nested list
  • Next by Date: Re: Applying a list of functions to a list of arguments
  • Previous by thread: Re: Re: Applying a list of functions to a list of arguments
  • Next by thread: Re: Applying a list of functions to a list of arguments