I'm having some issues with the following exercise:
I'm supposed to write a function that thats 3 numbers, x y n, being x and y the bottom and upper bounds of a list comprehension (respectively) and n being the number of partitions that comprehension will have.
E.g:
λ> partition 10 20 4
[10.0, 12.5, 15.0, 17.5, 20.0]
What I have done is the following:
partition :: Double -> Double -> Double -> [Double]
partition x y n = [a+b | b = (y-x) / n , a -> [x,b..y]]
I don't understand why i can't define the value of the b variable inside the comprehension, since when i try to run it i get the following error message:
parse error on input `='
NOTE: This is supposed to be a beginners exercise and this should have a simple resolution