История изменений
Исправление Virtuos86, (текущая версия) :
local
val foldl = List.foldl
val compare = String.compare
val rec sort = fn (x::xs, y) =>
val (a, b) = x
val (a1, b1) = y
case compare(a, a1) of
LESS => x::(sort(y, xs))
| EQUAL => x::y::xs
| GREATER => y::x::xs
in
val sorted = fn x::xs =>
foldl(sort, [x], xs)
end
Гм, накосячил. Теперь как надо.
Исходная версия Virtuos86, :
local
val foldl = List.foldl
val compare = String.compare
val rec sort = fn (x::xs, y) =>
val (a, b) = x
val y = (a1, b1)
case compare(a, a1) of
LESS => x::(sort(y, xs))
| EQUAL => x::y::xs
| GREATER => y::x::xs
in
val sorted = fn x::xs =>
foldl(sort, [x], xs)
end
Гм, накосячил. Теперь как надо.