Skip to content

Instantly share code, notes, and snippets.

@vbedegi
Created October 18, 2015 10:31
Show Gist options
  • Save vbedegi/460080935d6a909e9ca1 to your computer and use it in GitHub Desktop.
Save vbedegi/460080935d6a909e9ca1 to your computer and use it in GitHub Desktop.
open System
let ratio = (1.0 + Math.Sqrt(5.0)) / 2.0
let inputInt (prompt: String) =
Console.WriteLine(prompt)
int (Console.ReadLine())
let inputFloat (prompt: String) =
Console.WriteLine(prompt)
float (Console.ReadLine())
let inputValues cnt =
let rec inputValues cnt acc =
if cnt = 0 then
List.rev acc
else
inputValues ( cnt - 1) ((inputFloat "value: ") :: acc)
inputValues cnt []
[<EntryPoint>]
let main argv =
let numberOfValues = inputInt "how many of values:"
let values = inputValues numberOfValues
let results = List.map (fun x -> (x, x * ratio)) values
for x in results do
printfn "%A" x
Console.ReadKey()
0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment