From the course: Functional Programming with PHP

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 - PHP Tutorial

From the course: Functional Programming with PHP

Start my 1-month free trial

Partial application and currying

- [Narrator] The first advanced concept we're going to look at is something called partial application. What partial application is, 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 called the original function with all of its arguments. Another way to think of it is like this, normally when we call a function, we have to pass all the arguments to 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 the arguments it needs. Partial application is 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…

Contents