# Summation with Higher-Order Functions

In this lesson, we will go over a practical example of higher-order functions and see a higher-order function in action.

## We'll cover the following

## Solution

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.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy