I have the following function:
ParesImpares:: [Integer] -> ([Integer],[Integer])
I have to draw the odd and even pairs from a list:
ParesImpares [3,2,4,5,7]
- > ([2,4],[3,5,7])
My code so far is this:
paresImpares :: [Integer] -> ([Integer],[Integer])
paresImpares [] = ([],[])
paresImpares [x]
| x 'mod' 2 == 0 = ([x],[])
| otherwise = ([],[x])
I have a base case defined, but the truth is that I do not know how to continue. I had something like:
ParesImpares(x:xs) = ParesImpares [x]
But of course, only the first item on the list evaluates me.