Skip to content

Instantly share code, notes, and snippets.

@JefClaes
Created January 18, 2015 16:19

Revisions

  1. JefClaes created this gist Jan 18, 2015.
    14 changes: 14 additions & 0 deletions gistfile1.fs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    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)]