Create a gist now

Instantly share code, notes, and snippets.

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