Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let swA = new System.Diagnostics.Stopwatch()
- let swB = new System.Diagnostics.Stopwatch()
- let arr = [| 1 .. 1800 |]
- swA.Start()
- let mutable sum1 = 0
- for i in 0 .. 1799 do
- sum1 <- sum1 + i * arr.[i]
- done
- swA.Stop()
- swB.Start()
- let fProdSum arr = arr |> Array.mapi (fun i j -> i * j) |> Array.sum
- let sum2 = fProdSum arr
- swB.Stop()
- printfn "Results: %d %d" sum1 sum2
- printfn "Time elapsed Mine: %A" swA.Elapsed
- printfn "Time elapsed His: %A" swB.Elapsed
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement