---
title: "Higher Order Function in Erlang."  
description: "In mathematics and computer science, a higher-order function (also functional form, functional or functor) is a function that does at least one of the"  
author: "Sunil Singh"  
published: 2015-06-17  
updated: 2018-02-24  
canonical: https://www.mindstick.com/blog/10906/higher-order-function-in-erlang  
category: "erlang"  
tags: ["functional programming", "otp"]  
reading_time: 1 minute  

---

# Higher Order Function in Erlang.

**In [mathematics](https://www.mindstick.com/blog/302840/mathematics-and-its-applications-in-science-and-beyond) and [computer science](https://answers.mindstick.com/qa/112634/what-are-the-benefits-of-teaching-coding-and-computer-science-in-schools)**, a higher-order function (also functional form, functional or functor) is a function that does at least one of the following: takes one or more [functions](https://www.mindstick.com/forum/160140/explain-the-role-of-functions-as-a-service-faas-in-serverless-computing) as an input.

An important part of all [functional programming](https://www.mindstick.com/forum/23327/why-hasn-t-functional-programming-taken-over-yet) [languages](https://yourviews.mindstick.com/story/1463/some-oldest-languages-in-the-world-still-spoken) is the ability to take a function you defined and then pass it as a [parameter](https://www.mindstick.com/blog/450/parameter-class-in-c-sharp) to another function. **This, in turn, binds** that function parameter to a variable which can be used like any other variable within the function.

A function that can accept other functions transported around that way is named a higher order function. Higher-order functions are a powerful means of [abstraction](https://www.mindstick.com/articles/944/abstraction-in-c-sharp) and one of the best tools to master in Erlang.

## For example-

```
-module(functions).-export([add/2,one/0,two/0]).one() -> 1.two() -> 2.add(X,Y) -> X() + Y().functions:add(fun functions:one/0,fun functions:two/0). // function call
```

output=3.

---

Original Source: https://www.mindstick.com/blog/10906/higher-order-function-in-erlang

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
