title: Haskell creating my own filtering function
body: <p>I'm a new to haskell, I'm trying to create a function that will take a list on integers and returns a list containing two sublists, the first sublist containing the even number and the other containing the odd numbers. I cannot use even, odd or filter functions. i created my own functions as follows </p>
  
  <pre><code>myodd :: Integer -&gt; Bool
  myodd n = rem (abs(n)) 2 == 1
  
  myeven :: Integer -&gt; Bool
  myeven n = rem (abs(n)) 2 == 0
  
  segregate [] = ([], [])
  segregate [x] = ([x], [])
  segregate (x:y:xs) = (x:xp, y:yp) where (xp, yp) = segregate xs
  </code></pre>
  
  <p>im having trouble trying to use the two first functions and use it on the segregated functions. I have more experience in racket and the function I crated looks like this:</p>
  
  <pre><code>    (define (myeven? x)
    (= (modulo x 2) 0)) 
  
  (define (myodd? x)
    (= (modulo x 2) 1))
  
  (define (segregate xs)
    (foldr (lambda (x b)
             (if (myeven? x)
                 (list (cons x (first b)) (second b))
                 (list (first b) (cons x (second b))))) '(()()) xs))
  </code></pre>