MathGroup Archive 2009

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

Search the Archive

Re: How to make {f,g}[a,b,c] to become

  • To: mathgroup at smc.vnet.net
  • Subject: [mg105329] Re: [mg105301] How to make {f,g}[a,b,c] to become
  • From: Leonid Shifrin <lshifr at gmail.com>
  • Date: Sat, 28 Nov 2009 01:06:33 -0500 (EST)
  • References: <200911271127.GAA04398@smc.vnet.net>

Well,

here is one way:

In[1]:= {f,g}[a,b,c]/.(funs:{__})[args__]:>Map[Through[funs[#]]& ,{args}]

Out[1]= {{f[a],g[a]},{f[b],g[b]},{f[c],g[c]}}

But if I were you, I wouldn't bother - just remove the <&> signs for each
individual term in the list, and put one after the entire list:

{CountryData[#, "GDP"] , CountryData[#, "Population"] }& /@
 CountryData[]

Regards,
Leonid




On Fri, Nov 27, 2009 at 2:27 PM, Lawrence Teo <lawrenceteo at yahoo.com> wrote:

> I have a question. How to make {f,g}[a,b,c] to become {{f[a],g[a]},{f
> [b],g[b]},{f[c],g[c]}}?
>
> I want to do {GPD, Population} for all countries.
>
> Something similar to the following...
> {CountryData[#, "GDP"] &, CountryData[#, "Population"] &} /@
>  CountryData[]
>
> It ends up in the form of {f,g}[a,b,c,d,...]. I need a way to
> 'distribute' the country name into the GDP and Population portion.
>
> Thanks.
>
>



  • Prev by Date: Re: RevolutionPlot3D: Specifying the axis of rotation
  • Next by Date: Re: ItemSize and ImageSize->Full ,
  • Previous by thread: Re: How to make {f,g}[a,b,c] to become
  • Next by thread: Re: How to make {f,g}[a,b,c] to become {{f[a],g[a]},{f[b],g[b]},{f[c],g[c]}}