MathGroup Archive 2010

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

Search the Archive

Re: innerApply[{f, g}, {{a, b}, {c, d}}] = {f[a, b], g[c,d]} ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg109741] Re: innerApply[{f, g}, {{a, b}, {c, d}}] = {f[a, b], g[c,d]} ?
  • From: Adriano Pascoletti <adriano.pascoletti at uniud.it>
  • Date: Fri, 14 May 2010 05:36:18 -0400 (EDT)

In[2]:= innerApply[functionList_, argumentList_] :=
  MapThread[#1 @@ #2 &, {functionList, argumentList}];


In[3]:= innerApply[{f, g}, {{a, b}, {c, d}}]
Out[3]= {f[a, b], g[c, d]}


Adriano Pascoletti

2010/5/13 Fred Klingener <gigabitbucket at brockeng.com>

> This seems to work fine, but there must be a less clumsy way to do it:
>
> Clear[innerApply, functionList, argumentList, f, g, a, b, c, d]
>
> innerApply[functionList_, argumentList_] :=
>  Table[functionList[[j]] @@ argumentList[[j]], {j, 1,
>   Length[functionList]}]
>
> In[770]:= innerApply[{f, g}, {{a, b}, {c, d}}]
> Out[770]= {f[a, b], g[c, d]}
>
> TIA,
> Fred Klingener
>


  • Prev by Date: Re: innerApply[{f, g}, {{a, b}, {c, d}}] = {f[a, b], g[c,
  • Next by Date: Re: innerApply[{f, g}, {{a, b}, {c, d}}] = {f[a, b], g[c, d]} ?
  • Previous by thread: Re: innerApply[{f, g}, {{a, b}, {c, d}}] = {f[a, b], g[c,
  • Next by thread: Execute .m file with JLink