Types 关于无限类型的类型错误

Types 关于无限类型的类型错误,types,ml,Types,Ml,我正在尝试使用选择排序对一个简单函数进行排序,Im代码如下: fun slctsrt [] = [] | slctsrt (x::xs) = slctsrt2 (xs, x, []); fun slctsrt2 ([], min, []) = min | slctsrt2 ([], min, y::ys) = min :: slctsrt2 (ys, y, []) | slctsrt2 (x::xs, min, ys) = if x<min then slctsrt2 (xs,

我正在尝试使用选择排序对一个简单函数进行排序,Im代码如下:

fun slctsrt [] = []
 |  slctsrt (x::xs) = slctsrt2 (xs, x, []);
fun slctsrt2 ([], min, []) = min
 |  slctsrt2 ([], min, y::ys) = min :: slctsrt2 (ys, y, [])
 |  slctsrt2 (x::xs, min, ys) = if x<min then slctsrt2 (xs, x, min::ys)
                          else slctsrt2 (xs,min,x::ys);

函数slctsrt2应该返回一个列表。但是,第一条:

fun slctsrt2 ([], min, []) = min
返回“a”

应该是:

 fun slctsrt2 ([], min, []) = min :: []
或者
fun slctsrt2([],min,[])=[min]
 fun slctsrt2 ([], min, []) = min :: []