This is the function:
f [] = []
f (h:t) = (\x -> x - h) : f t
It takes a list and returns a list of anonymous functions, that substract each each element from x.
Apparently there is some way to write this whole function in 20 characters or less.
I tried to do it with map
but that just applies a function to each element of the list. I also tried to replace the anonymous function with (-a)
which didn't work either.
Does anybody have an idea?