I'm supposed to write a function that will contain the product of each previous multiplication with that number
Basically this:
> productFromLeftToRight [2,3,4,5]
[120,60,20,5]
I'm supposed to use High Order functions, so folds and such. I'm thinking of using a foldr to traverse through the list with a lambda expression. This is what I'm thinking:
> productFromLeftToRight nums = foldr (\x acc -> [x] * acc ++ acc) [] nums
Since it would unravel like f(2 (f 3 (f 4 (f 5 [])))) I would think I'm right, but I get the whole print error and I don't know how to multiply a number with the first element of acc ( head acc doesn't work)