Function that takes a list and a function. Then applies the function to each element of the list and sum results.