Skip to content

Instantly share code, notes, and snippets.

@wiig-with-a-k
Created March 28, 2014 14:15
Show Gist options
  • Save wiig-with-a-k/9833853 to your computer and use it in GitHub Desktop.
Save wiig-with-a-k/9833853 to your computer and use it in GitHub Desktop.
Short fsharp program to determine the table position for the norwegian Tipeliga based on tips found on the Internet
open System
//kannikskoleavis, TV2, NRK, VG, Aftenposten, Dagbladet
let tips = [|
("Bodø", [|7.0;12.0;11.0;10.0;10.0;13.0|]);
("Brann", [|9.0;7.0;6.0;5.0;5.0;6.0|]);
("Haugesund", [|6.0;5.0;7.0;7.0;6.0;7.0|]);
("Lillestrøm", [|8.0;11.0;12.0;13.0;13.0;9.0|]);
("Molde", [|1.0;2.0;2.0;1.0;3.0;2.0|]);
("Odd", [|13.0;9.0;5.0;6.0;7.0;10.0|]);
("Rosenborg", [|2.0;1.0;1.0;2.0;1.0;1.0|]);
("Sandnes", [|16.0;13.0;13.0;15.0;12.0;12.0|]);
("Sarpsborg", [|12.0;15.0;15.0;14.0;15.0;15.0|]);
("Sogndal", [|14.0;14.0;14.0;11.0;14.0;14.0|]);
("Stabæk", [|15.0;16.0;16.0;16.0;16.0;16.0|]);
("Start", [|10.0;10.0;10.0;12.0;11.0;11.0|]);
("Strømsgodset", [|4.0;3.0;3.0;3.0;2.0;3.0|]);
("Viking", [|3.0;4.0;4.0;4.0;4.0;4.0|]);
("Vålerenga", [|11.0;6.0;9.0;9.0;9.0;5.0|]);
("Aalesund", [|5.0;8.0;8.0;8.0;8.0;8.0|]);
|]
[<EntryPoint>]
let main argv =
let sortedResult = tips
|> Array.sortBy(fun (_, placings) -> (Array.average(placings)))
|> Array.iter(fun (team, placings) -> (printfn "Tabellplassering for: %s er: %e" team (Array.average placings)))
Console.Read() |> ignore
0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment