Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Calculating all factorials of numbers 1 to 51,000
open System
open System.Diagnostics
let rec fac x = if x < 1.0 then 1.0 else x * fac(x-1.0)
let watch = new Stopwatch()
watch.Start()
let complexComputation = Async.Parallel [for i in 0.0..51000.0 -> async { return fac(i) }] |> Async.RunSynchronously;;
watch.Stop()
let result = watch.Elapsed.Seconds.ToString()
printfn "%s" result;;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment