我想将一个 int 插入到排序列表中的正确位置。例如,如果我插入 2,它将插入第二个位置。
insert :: Int -> [Int] -> [Int
insert x [] = [x]
insert x (y:ys) = if xsy
then x:y:ys else y insert x ys
任何人都可以指出什么是错的。谢谢
我想将一个 int 插入到排序列表中的正确位置。例如,如果我插入 2,它将插入第二个位置。
insert :: Int -> [Int] -> [Int
insert x [] = [x]
insert x (y:ys) = if xsy
then x:y:ys else y insert x ys
任何人都可以指出什么是错的。谢谢