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

• To: mathgroup at smc.vnet.net
• Subject: [mg105326] Re: [mg105301] How to make {f,g}[a,b,c] to become
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Sat, 28 Nov 2009 01:05:59 -0500 (EST)

```A few more ways of obtaining the table

properties = {"Name", "GDP", "Population"};

Outer[CountryData[#1, #2] &,
CountryData[], properties] ==
({CountryData[#, "Name"],
CountryData[#, "GDP"],
CountryData[#, "Population"]} & /@
CountryData[]) ==
CountryData[#, properties]] & /@
CountryData[]] ==
(Table[CountryData[#, p], {p, properties}] & /@
CountryData[]) ==
Table[CountryData[c, p],
{c, CountryData[]}, {p, properties}]

True

Bob Hanlon

---- Bob Hanlon <hanlonr at cox.net> wrote:

=============

Outer[#2[#1] &, {a, b, c}, {f, g}]

{{f[a], g[a]}, {f[b], g[b]}, {f[c], g[c]}}

Outer[CountryData[#1, #2] &, CountryData[],
{"Name", "GDP",
"Population"}] ==
({CountryData[#, "Name"],
CountryData[#, "GDP"],
CountryData[#, "Population"]} & /@ CountryData[])

True

Bob Hanlon

---- 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: Replacement rules that contain function arguments (evaluation order)
• Next by Date: problem about MLPutRealArray
• 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