You can use standard .NET tasks for this - there are no special F # functions or special syntax for spawning computations in the background:
let a1Work = Task.Factory.StartNew(fun () ->
Array.map2 (fun a b->(1.0-a)/(a-b)) a2 a3)
let b1 = Array.map2 (fun a b->a*b) b2 b3
let a1 = a1Work.Value
I also changed yours Seq.map2to Array.map2- computing on sequences is lazy, and so running them inside a task actually did nothing. With arrays, the entire calculation completes immediately.
source
share