From the course: Functional Programming with Java

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Partial application and currying

Partial application and currying - Java Tutorial

From the course: Functional Programming with Java

Start my 1-month free trial

Partial application and currying

- The first advanced concept we're going to look at here is called partial application. So what is partial application? Well, in simple terms, partial application is when we take a function that has some number of arguments, and we fix some of those arguments to a set value. This function with fixed arguments can then be called from anywhere else in the code, and it will be as if we had called the original function with all of its arguments. Another way to think about it as like this. Normally when we call a function we have to pass all the arguments into it at the same exact time and place. What partial application allows us to do, is pass arguments to a function at different places in the code and then get the result once the function gets all of the arguments it needs. Now, partial application is also a very useful way to configure more general functions into more specific ones. In general, if there's a function that we use often in our code where one or more of the arguments that…

Contents