Skip to content

Instantly share code, notes, and snippets.

@khanghoang
Created October 31, 2015 15:06
Show Gist options
  • Save khanghoang/9851101af8e715733811 to your computer and use it in GitHub Desktop.
Save khanghoang/9851101af8e715733811 to your computer and use it in GitHub Desktop.
Currying requirement

Here's the basic usage of the file that you'll be creating:

var curry = require('./') // <- this is the file you make;

function add(a, b) { return a + b; }

var curried = curry(add); console.log( curried(1)(2) ); // 3 More info: https://en.wikipedia.org/wiki/Currying

@maxrimue
Copy link

@khanghoang You might want to wrap the code in a code wrapper of Markdown for enabling syntax highlighting. How you do it is explained here. With it, your gist can look like this:

Here's the basic usage of the file that you'll be creating:

var curry = require('./') // <- this is the file you make;

function add(a, b) { return a + b; }

var curried = curry(add); console.log( curried(1)(2) ); // 3 

More info: https://en.wikipedia.org/wiki/Currying

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment