Does F# List.Map guarantee the executing order from left item to right item?
I have a list of http commands which need to be executed in a particular order开发者_如何学JAVA.
Let cmd = [
(Get, "http://login.xxx.com");
(Post, "http://login.xxx.com", "login=name;password=pwd");
....]
cmd |> List.map (crawl)
Will the crawl always run the http requests top-down (even in a multiple core computer)? What's the best way to force the executing order if it cannot be guaranteed?
Yes, List.map is single threaded so the order of execution is guaranteed. You just need to ensure your crawl function doesn't lanch asynchonous fire and forget operations, this is probably already the case as it's the simplest way do things, i.e. ensure you use WebClient.DownloadString
not the async version.
精彩评论