Re: How to make {f,g}[a,b,c] to become {{f[a],g[a]},{f[b],g[b]},{f[c],g[c]}}
- To: mathgroup at smc.vnet.net
- Subject: [mg105318] Re: How to make {f,g}[a,b,c] to become {{f[a],g[a]},{f[b],g[b]},{f[c],g[c]}}
- From: Szabolcs Horvát <szhorvat at gmail.com>
- Date: Sat, 28 Nov 2009 01:04:29 -0500 (EST)
- References: <heoe15$4ph$1@smc.vnet.net>
On 2009.11.27. 12:43, Lawrence Teo 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.
>
Instead of trying to transform an awkward result into a convenient one,
generate the convenient one directly:
{CountryData[#, "GDP"], CountryData[#, "Population"]} & /@
CountryData[]