Skip to content

Instantly share code, notes, and snippets.

@KaeruCT
Created February 11, 2014 18:35
Show Gist options
  • Save KaeruCT/8941118 to your computer and use it in GitHub Desktop.
Save KaeruCT/8941118 to your computer and use it in GitHub Desktop.
// six(dividedBy(two())) == 3
var self = this;
['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'].forEach(function (el, i) {
self[el] = (function (i) {
return function (op) {
return op ? op(i) : i;
};
}(i));
});
function plus(b) {return function (a) {return a + b;}}
function minus(b) {return function (a) {return a - b;}}
function times(b) {return function (a) {return a * b;}}
function dividedBy(b) {return function (a) {return a / b;}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment