映射在F#auto中,但我不知道为什么

Ant*_*ell 0 f#

所以,当我做这样的事情

let mainMenu() = ["1. list item one",itemOne
                  "2. list item two",itemTwo
                  "3. list item three",itemThree
                  "4. list item four",itemFour
                  "0. Exit",exitApplication] 
                  |> Map.ofList
Run Code Online (Sandbox Code Playgroud)

然后像这样打印出来

mainMenu() 
|> Seq.iter(fun keyValuePair -> 
    Console.WriteLine (sprintf "%s" (keyValuePair.Key |> string))) 
Run Code Online (Sandbox Code Playgroud)

我得到了结果

0. Exit
1. list item one
2. list item two
3. list item three
4. list item four
Run Code Online (Sandbox Code Playgroud)

所以我的问题是,如何将0放在列表中?

我的假设是它正在对char 0进行哈希处理,因为它的ascii值较低,所以它早先被放入了一个桶中.

sep*_*p2k 5

F#Map是使用二叉搜索树(特别是AVL树,我相信)实现的,而不是哈希映射.迭代二叉搜索树深度优先为您提供排序顺序的项目.