Last active
August 29, 2015 14:13
-
-
Save JefClaes/a5464518bbabb1e0b5eb to your computer and use it in GitHub Desktop.
Averages are not good enough (1)
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
| let average input = | |
| let length = input |> Seq.length | |
| match length with | |
| | 0 -> raise <| new ArgumentException("Input sequence is empty") | |
| | _ -> (input |> Seq.sum) / float length | |
| // Average = 45.625 | |
| // (18 + 21 + 41 + 42 + 48 + 50 + 55 + 90) / 8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment