Https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application

Tell us what’s happening:
Describe your issue in detail here.
I’m having trouble understanding partial applications and how is it beneficial in functional programming. Can someone explain with reference to the code below?

Your code so far




function impartial(x, y, z) {
  return x + y + z;
}
var partialFn = impartial.bind(this, 1, 2);
partialFn(10); // 13

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36

Challenge: Introduction to Currying and Partial Application

Link to the challenge:

this is how I do understand it:
partial application helps for example if you have a code library where it gives you some function with some strict parameters, and you need to use it in another way, for example fulfiling its parameters step by step.

The bit that always throws me in that is the bind, largely because i rarely use it. But Javascript Bind, Partial Application, and Currying - David Calhoun's blog is a great post comparing partial application and currying, similar and different, and where bind fits in.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.