Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Basic usage pattern of a curry function.
- ```js
- const a = [1,2,3,4];
- console.log(a.map(x => x*2)); // [2, 4, 6, 8]
- ```
- Here is the same thing using currying.
- ```js
- // Curry function
- const mulby = y => x => x*y;
- // New lambda partion
- const mul2 = mulby(2);
- console.log(a.map(mul2)); // [2, 4, 6, 8]
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement