Standard sorting functions in SML?

后端 未结 5 741
夕颜
夕颜 2020-12-11 02:21

Are there standard sorting functions in SML? The documentation on the Internet is so scarce I couldn\'t find any.

5条回答
  •  感动是毒
    2020-12-11 03:22

    How about this for sorting a list? You could always use reverse to get the reverse.

    - fun sort(L) =
       if L=[] then []
       else if tl(L)=[] then L
       else merge(sort(take(L)), sort(skip(L)));
     val sort = fn : int list -> int list
    

    See here.

提交回复
热议问题