This is my sumEvenOdd function that takes a list of numbers. It returns a tuple of two numbers: the sum of the even-index items in the given list, and the sum of the odd-index items. Indices are zero-based.
sumEvenOdd :: Num a => [a] -> (a, a)
sumEvenOdd (x:xs) = ((foldl1 (+) (evens(xs))), (foldl1 (+) (odds(xs)))) where
evens (x:xs) = x:odds xs
odds (_:xs) = evens xs
To get my odds I just skip a spot
If I call sumEvenOdd [1,2,3,4] should return (4,6) or, sumEvenOdd [] should return (0,0).
But I get " Exception:Non-exhaustive patterns in function odds "
I just don't see where the redundant pattern is.