Skip to content

Instantly share code, notes, and snippets.

@JefClaes
Last active August 29, 2015 14:13
Show Gist options
  • Select an option

  • Save JefClaes/a5464518bbabb1e0b5eb to your computer and use it in GitHub Desktop.

Select an option

Save JefClaes/a5464518bbabb1e0b5eb to your computer and use it in GitHub Desktop.
Averages are not good enough (1)
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