Advertisement
Guest User

Untitled

a guest
Oct 29th, 2013
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 0.94 KB | None | 0 0
  1. let main () =
  2.     let data = WorldBank.GetDataContext()
  3.  
  4.     // Pull out some countries from the WorldBank...
  5.     let countries = [|
  6.         data.Countries.``United Kingdom``
  7.         data.Countries.``United States``
  8.         data.Countries.France
  9.         data.Countries.Italy
  10.         data.Countries.``Russian Federation``
  11.         data.Countries.Norway
  12.         data.Countries.China
  13.     |]
  14.  
  15.     // For each of the countries selected...
  16.     countries |> Array.iter (fun c ->
  17.         async {
  18.             // Asynchronously pull out the percentage of income
  19.             // held by the highest 10% of earners...
  20.             let! indicator = c.Indicators.``Income share held by highest 10%``
  21.             let incomeShare = indicator |> Seq.last |> snd
  22.             // Append some text to the "results" div...
  23.             jq?results.append(jq ("<p>" + c.Name + " : " + incomeShare.ToString() + "%</p>")) |> ignore
  24.         } |> Async.StartImmediate
  25.     )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement