So, the title describes it all.
Seq.iter (fun item -> (*do something*)) sequence
Can I run all those lambda-functions as parallel? It can be useful when this function does some big work.
Sure, if you are targeting .NET 3.5 +, then
{1..100} |> PSeq.iter (printfn "%A")If you are targeting .NET 2.0, follow my instructions here to compile a back-ported version of System.Linq.ParallelEnumerable from the Rx project into the PowerPack Parallel.Seq project.
If you want to run the function in parallel just use the Parallel.ForEach function
Parallel.ForEach(sequence, fun item -> (* do something *))
This works just fine from F#
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With