Update article.md
This commit is contained in:
parent
0a95d04b17
commit
effc64ab00
1 changed files with 2 additions and 2 deletions
|
@ -65,9 +65,9 @@ alert( triple(5) ); // = mul(3, 5) = 15
|
||||||
|
|
||||||
Why do we usually make a partial function?
|
Why do we usually make a partial function?
|
||||||
|
|
||||||
Here our benefit is that we created an independent function with a readable name (`double`, `triple`). We can use it and don't write the first argument of every time, cause it's fixed with `bind`.
|
The benefit is that we can create an independent function with a readable name (`double`, `triple`). We can use it and not provide first argument of every time as it's fixed with `bind`.
|
||||||
|
|
||||||
In other cases, partial application is useful when we have a very generic function, and want a less universal variant of it for convenience.
|
In other cases, partial application is useful when we have a very generic function and want a less universal variant of it for convenience.
|
||||||
|
|
||||||
For instance, we have a function `send(from, to, text)`. Then, inside a `user` object we may want to use a partial variant of it: `sendTo(to, text)` that sends from the current user.
|
For instance, we have a function `send(from, to, text)`. Then, inside a `user` object we may want to use a partial variant of it: `sendTo(to, text)` that sends from the current user.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue