Create a divisors :: Int -> [Int] function that returns the divisors of x.
I've successfully made a divides function that returns True if y is a divisor of x.
divides x y | mod x y == 0 = True
| mod x y /= 0 = False
I've tried to use it to filter numbers from [1..n] , but can't exactly get a grasp on how the filter function works. Can anyone set me in the right direction?
divisors n = filter divides n [1..n]