[Haskell-cafe] How to remove all numbers from a list that are
divisible by an integer
mirandakajtazi at gmail.com
Mon Feb 5 13:11:01 EST 2007
I'm trying to create a function which filters out all number from a list
that are divisible by an integer.
Ex. the list [2,3,4,5,6] div 2...should give me the list like: [3,5], other
numbers should be removed divisible by 2.
filter :: (a -> Bool) -> [a] -> [a]
filter p  = 
filter p (x:xs) = if p 'mod' x
then x : filter p xs
else filter p xs
I tried this, but it doesn't work!!!!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe