When I started to learn functional , I learned a lot of interesting concepts. But I was wondering where I could use them in the real world. Indeed, most tutorial give examples of those concepts in simple code: programming Nice, this works, but I rarely write addition in my code. I could use this to increment something with a function. But most language have an easy way of doing this or . Why bother? addOne() i++ i += 1 Let’s review this code nevertheless. The first line creates a function that takes one parameter and it returns another function that also takes one parameter. The returned already has a value for , and is waiting for a value. That second function adds the first and the second parameter and returns the result. To make it clear, that first line could be written as follow: add() function a b You clearly see the benefit of the less verbose ES6 syntax… You can call this function in two ways: the one I have just shown you: and . The first example is an example of currying and it is more or less the example you will see in many tutorials. The second one is actually giving you a result (4). const addTwo = add(2) const result = add(2)(2) Currying is: the technique of translating the evaluation of a function that takes multiple arguments (or a tuple of arguments) into evaluating a sequence of functions, each with a single argument. Ok… I have created a function that will always add two to any that you will give it. And concatenate a string to two if you give it a string… addTwo() int Fine… what do I do with this. Where can currying be useful in the real world. Let’s do some refactoring: This is method in a small library that help me parse data coming from an API first CMS ( ). I need to format dates as the corporate guideline, parse markdown, create documents and images url. This is the method that parses those urls. Cloud CMS per This method maps all the returned objects from the API, then maps each properties and parses the appropriate ones. Let’s apply the knowledge we now have about currying to refactor this method. Notice that on line 8, 15, 20 and 24 we call the same function again and again with slight parameter variations: . This function takes 3 arguments and two optional ones. First a , then a of attachement and the object. (attachement is a Cloud CMS concept where a document is attached to a node, and linked with a relation that can be followed. Cloud CMS uses a graph database). The optional arguments are and . self.attachementUrl() baseUrl type attachement size mimetype This is our opportunity to curry some functions! What we can do is create a function like the one that we have seen and two partially applied functions that we will use in the code: add() The function takes first the , then the (preview or static) and then two arguments and . We can pass them together, because we know that we format the images for each case with a specific size. When we call we do the actual work, this is the of the basic example. parse() baseUrl type attachement size self.attachementUrl() a + b Then we can create two partially applied functions: and . These two functions correspond to the function we saw earlier. We partially apply two arguments that will not change, and we leave the two other ones to be used in the code specifically. parsePreview() parseStatic() addTwo() Thus we can replace our previous code with the following: On line 12, 19, 24, 28 we give the last arguments to our partially applied functions. In this example we did not reduce the amount of lines, but by using curried functions, we improve maintainability of our code as we repeat ourselves less. I think this is one of the aim of functional programming: have a code that is more maintainable, by using small functions, that do one thing, but that do it reliably. This code is a little in between, as this was the first time I saw the opportunity to curry a function in my code. But now I try to apply functional programming as much as possible, even within Object Oriented projects. To finish on an historical note, have you ever wondered why currying is called currying? Actually it has nothing to do with India. It simply a reference to the mathematician and logician Haskell Brooks Curry. Thanks to for his comment. apy