[Haskell-cafe] How to remove all numbers from a list that are divisible by an integer

2007-02-05 Thread Miranda Kajtazi
Hi, Thanx to all for the previous hints how to solve and write the function to calculate the sum of a list of lists. Now I need to know how to remove all numbers that are divisable by an integer. Lets say I have a list [2,4,5,6,8] and when I divide them with number 2, my list should look like

Re: [Haskell-cafe] How to remove all numbers from a list that are divisible by an integer

2007-02-05 Thread Neil Mitchell
Hi Miranda, Now I need to know how to remove all numbers that are divisable by an integer. Is this a homework problem? Is there some bigger goal you are trying to achieve? I tried to use some zipWith...filter and other predefined functions..but I can't really find the right solution :(

[Haskell-cafe] How to remove all numbers from a list that are divisible by an integer

2007-02-05 Thread Miranda Kajtazi
Hi all, 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

Re: [Haskell-cafe] How to remove all numbers from a list that are divisible by an integer

2007-02-05 Thread Neil Mitchell
Hi Miranda, 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 You are mixing a few things together. First point, mod should be `mod` and not