Services & Resources / Wolfram Forums / MathGroup Archive
-----

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: [mg109729] Re: innerApply[{f, g}, {{a, b}, {c, d}}] = {f[a, b], g[c, d]} ?
  • From: Raffy <adraffy at gmail.com>
  • Date: Fri, 14 May 2010 05:34:01 -0400 (EDT)
  • References: <hsgnjt$d6o$1@smc.vnet.net>

On May 13, 4:25 am, Fred Klingener <gigabitbuc... at BrockEng.com> wrote:
> 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

m = {{a, b}, {c, d}};
m[[All, 0]] = {f, g};

ReplacePart[{{a, b}, {c, d}}, MapIndexed[Append[#2, 0] -> #1 &, {f,
g}]]

MapThread[#1 @@ #2 &, {{f, g}, {{a, b}, {c, d}}}]


  • Prev by Date: Re: innerApply[{f, g}, {{a, b}, {c, d}}] = {f[a, b], g[c,d]} ?
  • Next by Date: Re: innerApply[{f, g}, {{a, b}, {c, d}}] = {f[a, b],
  • Previous by thread: Re: innerApply[{f, g}, {{a, b}, {c, d}}] = {f[a, b], g[c, d]} ?
  • Next by thread: Re: innerApply[{f, g}, {{a, b}, {c, d}}] = {f[a, b], g[c, d]} ?