Skip to content

Instantly share code, notes, and snippets.

@bohdanszymanik
Last active February 22, 2016 02:06
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 bohdanszymanik/eeb2cba00061ec282017 to your computer and use it in GitHub Desktop.
Save bohdanszymanik/eeb2cba00061ec282017 to your computer and use it in GitHub Desktop.
let (>|>) x f =
let timer = new System.Diagnostics.Stopwatch()
timer.Start()
let r = f x
printfn "Elapsed Time: %i" timer.ElapsedMilliseconds
r
[1..1000]
>|> List.map (fun x -> [1..x] |> List.sum)
>|> List.max
>|> fun v -> [1..v]
>|> List.averageBy float
(* gives following output
Elapsed Time: 55
Elapsed Time: 0
Elapsed Time: 60
Elapsed Time: 8
Real: 00:00:00.126, CPU: 00:00:00.124, GC gen0: 6, gen1: 0, gen2: 0
val it : float = 250250.5
*)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment