There's more...

There is a similar pattern called partial application. It is more flexible than currying as it doesn't limit the number of arguments handled by each of the functions. For example, given a foo function declared as follows:

fun foo(a: A, b: B, c: C): D 

We could transform it into the following form:

fun foo(a: A, c: C) -> (B) -> D

Both currying and partial application are useful whenever we can't provide the full number of required arguments to the function in the current scope. We can apply only the available ones to the function and return the transformed function.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.68.182