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
  • Subject: [mg105326] Re: [mg105301] How to make {f,g}[a,b,c] to become
  • From: Bob Hanlon <hanlonr at>
  • Date: Sat, 28 Nov 2009 01:05:59 -0500 (EST)
  • Reply-to: hanlonr at

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}]


Bob Hanlon

---- Bob Hanlon <hanlonr at> 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[])


Bob Hanlon

---- Lawrence Teo <lawrenceteo at> wrote: 

I have a question. How to make {f,g}[a,b,c] to become {{f[a],g[a]},{f

I want to do {GPD, Population} for all countries.

Something similar to the following...
{CountryData[#, "GDP"] &, CountryData[#, "Population"] &} /@

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.


  • 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