我正在尝试编写一个 Haskell 代码,它接受一个列表并返回一个列表列表。当我按照以下代码执行此操作时,我得到“函数 reGroup 中的非详尽模式”
reGroup :: [[Int]] -> [Int] -> [[Int]]
reGroup [[]] [] = [[]]
reGroup [[]] xs = reGroup [(take 3 xs)] (drop 3 xs)
reGroup [[a]] [] = [[a]]
reGroup [[a]] xs = reGroup [[a], (take 3 xs)] (drop 3 xs)
-- calling the reGroup function from another function as follow
reGroup [[]] [1,2,3,4,5,6,7,8,9]
我想要的是[1,2,3,4,5,6,7,8,9]
-> [[1,2,3], [4,5,6], [7,8,9]]
。我做错了什么或者有人可以告诉我一个简单的方法吗?