Are there standard sorting functions in SML? The documentation on the Internet is so scarce I couldn\'t find any.
Here is a standard quicksort
fun qsort(func) =
let fun sort [] = []
| sort (lhd :: ltl) =
sort (List.filter (fn x => func (x, lhd)) ltl)
@ [lhd]
@ sort (List.filter (fn x => not (func(x, lhd)) ltl)
in sort
end
Just throw in some comparator (function that takes two elements with same type and return boolean) and it will return a sort function for you If you got anymore question don't hesitate to ask. :)