让语句错误

时间:2015-07-27 12:42:38

标签: sorting haskell insertion-sort

我遇到以下haskell语句的问题:

insertSort3 xs =
    let sort3 [] ys = ys
         sort3 (x:xs) ys = sort3 xs (insert x ys)
    in sort3 xs []

我的编译器说:输入'='时解析错误(错误发生在第三行)。

1 个答案:

答案 0 :(得分:5)

问题是let第二行中的缩进:

insertSort3 xs = 
 let sort3 [] ys = ys
     -- the next line should line up with the previous sort3
     sort3 (x:xs) ys = sort3 xs (insert x ys)
 in sort3 xs []