Xer*_*tek 1 sorting haskell insertion-sort
我有以下haskell语句的问题:
insertSort3 xs =
let sort3 [] ys = ys
sort3 (x:xs) ys = sort3 xs (insert x ys)
in sort3 xs []
Run Code Online (Sandbox Code Playgroud)
我的编译器说:在输入'='上解析错误(错误发生在第三行).
问题是第二行中的缩进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 []
Run Code Online (Sandbox Code Playgroud)