Last active
October 3, 2018 11:47
-
-
Save e-mihaylin/fed58b0bdcf698a2438b40c2128179ec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const add = n => { | |
const f = x => add(n + x); | |
f.valueOf = () => n; | |
return f; | |
} | |
// Other Variants: | |
function add(n) { | |
var f = function(x) { return add(n+x); }; | |
f.valueOf = function() { return n; }; | |
return f; | |
} | |
function add(n){ | |
var fn = function(x){ return add(n+x); } | |
fn.toString = function(){ return n; } | |
return fn; | |
} | |
function add(n) { | |
var next = add.bind(n += this | 0); | |
next.valueOf = function() { return n; }; | |
return next; | |
} | |
function add(n){ | |
function monad(m){return add(n+m)} | |
monad.valueOf = function valueOf(){return n}; | |
return monad; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment