Skip to content

Instantly share code, notes, and snippets.

@JefClaes
Created January 18, 2015 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JefClaes/1229fd20a7f271480b19 to your computer and use it in GitHub Desktop.
Save JefClaes/1229fd20a7f271480b19 to your computer and use it in GitHub Desktop.
Averages are not good enough (3)
let frequencyDistribution input =
input |>
Seq.groupBy (fun x ->
match x with
| x when x < 30.0 -> [ 0, 30 ]
| x when x < 70.0 -> [ 30, 70 ]
| x when x < 90.0 -> [ 70, 90 ]
| _ -> [ 90, System.Int32.MaxValue ] ) |>
Seq.map (fun (x, y) -> x, y |> Seq.length)
// Frequency Distribution = seq [
// ([(0, 30)], 2);
// ([(30, 70)], 5);
// ([(90, 2147483647)], 1)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment