Created
October 18, 2015 10:31
-
-
Save vbedegi/460080935d6a909e9ca1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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