我正在尝试插入两个这样的列表:
intercalate [0, 2, 4] [1, 3, 5]
[0, 1, 2, 3, 4, 5]
Run Code Online (Sandbox Code Playgroud)
所以我创建了这个函数:
intercalate (x:xs) (y:ys) = x:(y:(intercalate xs ys))
intercalate [] [] = []
Run Code Online (Sandbox Code Playgroud)
但是我总是得到这个错误:
Exception: <interactive>:3:5-57: Non-exhaustive patterns in function intercalate
Run Code Online (Sandbox Code Playgroud)
我不明白为什么!