https://github.com/wdalmut/curry
An example of currying and partial application
https://github.com/wdalmut/curry
currying functional-programming
Last synced: 5 months ago
JSON representation
An example of currying and partial application
- Host: GitHub
- URL: https://github.com/wdalmut/curry
- Owner: wdalmut
- Created: 2018-08-17T07:55:30.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-17T16:35:12.000Z (over 7 years ago)
- Last Synced: 2025-10-14T20:13:47.468Z (5 months ago)
- Topics: currying, functional-programming
- Language: JavaScript
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Partial application and curring for functions
A simple example of partial application and curring applied to functions
## Curring
```js
const curry = require('.');
const sum = curry((a,b) => a+b);
sum(1,1) // direct 2
sum(1)(1) // with curry 2
```
## Partial Application
```js
const curry = require('.');
const sum = curry((a,b,c) => a+b+c);
sum(1,1,1) // direct 3
sum(1)(1)(1) // with curry 3
sum(1,1)(1) // with left partial application
sum(1)(1,1) // with right partial application
```