To solve the problem discussed in the previous lesson, let’s first define a higher-order recursive function sum which takes three parameters; a function f and two integers a and b (representing the lower and upper bounds respectively). The basic functionality of sum is to take the sum of all the integers between a and b. The function to be passed as an argument will perform some operation on the integers between a and b, ex. returning their cube. The result of the parameter function will then be summed to get the result of the higher-order function.