mirror of
https://github.com/rjNemo/functional-programming-jargon
synced 2026-06-11 04:56:40 +00:00
Partial Application defined.
This commit is contained in:
parent
7f78cfce9e
commit
2d9af62849
1 changed files with 12 additions and 0 deletions
12
readme.md
12
readme.md
|
|
@ -31,6 +31,18 @@ greet("HOF")(); // Hello HOF!
|
||||||
```
|
```
|
||||||
|
|
||||||
## Partial Application
|
## Partial Application
|
||||||
|
> The process of getting a function with lesser arity compared to the original
|
||||||
|
function by fixing the number of arguments is known as partial application.
|
||||||
|
|
||||||
|
```js
|
||||||
|
let sum = (a, b) => a + b;
|
||||||
|
|
||||||
|
// partially applying `a` to `40`
|
||||||
|
let partial = add.bind(null, 40);
|
||||||
|
|
||||||
|
// Invoking it with `b`
|
||||||
|
partial(40); //=> 42
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue