当前位置: 动力学知识库 > 问答 > 编程问答 >

functional programming - 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.

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: