Haskell non-exhaustive patterns in function with `otherwise`

后端 未结 1 825
情深已故
情深已故 2021-01-23 14:48

I am using the following function:

combinations :: Int -> [a] -> [[a]]
combinations k xs = combinations\' (length xs) k xs
  where combinations\' n k\' l@(         


        
相关标签:
1条回答
  • 2021-01-23 15:14

    Because of l@(x:xs) in combinations' n k' l@(y:ys) you're missing the case combinations _ _ [].

    The guard null l will always be False.

    0 讨论(0)
提交回复
热议问题