haskell - Intercalate function giving Non-exhaustive patterns -
i'm trying intercalate 2 lists this:
intercalate [0, 2, 4] [1, 3, 5] [0, 1, 2, 3, 4, 5]
so created function:
intercalate (x:xs) (y:ys) = x:(y:(intercalate xs ys)) intercalate [] [] = []
however error:
exception: <interactive>:3:5-57: non-exhaustive patterns in function intercalate
i can't understand why!
a hint should enough here:
you handle case in both lists empty.
you handle case in both lists nonempty.
can think 2 more cases?
Comments
Post a Comment