-
Notifications
You must be signed in to change notification settings - Fork 0
Partial Application vs Currying
Daisho Komiyama edited this page Aug 10, 2019
·
3 revisions
Here's tl;dr of Partial Application and Currying characteristics.
- Both are specialization techniques
- Partial Application presets some arguments now, receives the rest on the next call
- Currying doesn't preset any arguments, receives each argument one at a time
If you ever get asked on a future job interview, what's the difference? What's partial application and currying? The answer is, both of them specialize, they do it differently.
- Partial Application takes some input now, all the rest of the input later
- Currying takes no input now, each input one at a time
const ajax = curry(3, function ajax(url, data, cb) {
//some work here
});
//strict currying
ajax(CUSTOMER_API)({id: 42})(renderCustmer);
//loose currying
ajax(CUSTOMER_API, {id: 42})(renderCustmer);