F# how to do List.map in parallel -
what lightweight, terse way run following code in parallel within standard f# libs? or failing used additional libs?
let newlist = oldlist |> list.map mycomplexfunction
the best find
let newlist = oldlist |> list.map (fun x -> async { return mycomplexfunction x } |> async.parallel |> async.runsynchronously |> array.tolist
i don't because it's 4 lines long , constructs array have make list. if working arrays simple, array.parallel, want keep lovely immutable list functional purity. can't believe there no list alternative, far have been unable find one. suggestions?
use pseq
module:
open microsoft.fsharp.collections let newlist = oldlist |> pseq.map mycomplexfunction |> pseq.tolist
Comments
Post a Comment