Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试声明一个函数sort : real list -> int list * real list,该函数使用 mergesort 对列表进行排序,并返回一个 int 列表,其中包含预排序的各个数字的原始位置。
sort : real list -> int list * real list
也许这个例子会更容易理解:
sort [5.4,7.2,1.5,9.6] = ([2,0,1,3], [1.5,5.4,7.2,9.6]
现在列表的排序非常容易,但我很难弄清楚如何让它记住原始位置,然后用它制作一个 int 列表。
帮助?
ListPair.unzip