More servicesWindows Live
HomeHotmailSpacesOneCare
 
MSN
Sign in
 
 
Spaces home  Inside F#ProfileFriendsBlogGuestbook Tools Explore the Spaces community
Thanks for visiting!
Comments (1)
  • View space
    May 05 11:29 AM
    Thanks for the great post!  On my machine (two Intel Xeon E5335 @ 2 GHz with 4 GB of RAM, i.e. 8 cores) this takes 2256 ms.
    The single threaded version takes 17470 ms.
     
    The first set of code works:
     
    let info = nums |> Array.map (fun x -> async { return (x, IsPrime x) } )

    // par : Async<array<int * bool>>

    let par = Async.Parallel info

    // primeInfo : array<int * bool>

    let primeInfo = Async.Run par

     
    The second does not:
     

    let primeInfo = nums

    |> Array.map (fun x -> async { return (x, IsPrime x) } )

    |> Async.Parallel

    |> Async.Run

     
    I get an error on "Aysnc.Run":
     
    This expression has type  'a * 'b but is here used with type  Async<(int * bool) array
     
    Any ideas?
     
    Thanks,
    Dan