Currying

This converts a function with multiple input parameter to a function which takes one parameter at a time, or we can say it breaks the function into multiple functions, each taking one parameter at a time. Here is an example:

int sum = (a,b) => a+b
int sumcurry = (a) =>(b) => a+b
sumcurry(5)(6) // 11
int sum8 = sumcurry(8) // b=> 8+b
sum8(5) // 13
..................Content has been hidden....................

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