Advertisement
Guest User

Untitled

a guest
Jun 9th, 2015
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 0.86 KB | None | 0 0
  1. #r "FSharp.Data.dll"
  2. open System
  3. open System.Collections.Generic
  4. open FSharp.Data
  5.  
  6. let getCities =
  7.     fun () ->
  8.         let mutable continueLooping = true
  9.         let cities = new List<string>()
  10.         while continueLooping do
  11.             Console.Write "Enter city to visualize: "
  12.             let city = Console.ReadLine()
  13.             if city = "end" then
  14.                 continueLooping <- false
  15.             else
  16.                 cities.Add(city)
  17.         (cities)
  18.  
  19. let klvToFarnht (k:float) =
  20.     fun () ->
  21.         ((k - 273.15)*1.8000 + 32.00)
  22.  
  23. [<Literal>]
  24. let sample = "http://api.openweathermap.org/data/2.5/weather?q=London"
  25. let apiUrl = "http://api.openweathermap.org/data/2.5/weather?q="
  26.  
  27. type Weather = JsonProvider<sample>
  28.  
  29. for i in getCities() do
  30.     let sf = Weather.Load(apiUrl + i)
  31.     Console.WriteLine klvToFarnht sf.Main.Temp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement