Can't live if livin' is without you
Apr 13, 2017
Choose currying, or not.
var napravi = function(x) {
return function(y) {
return x + y;
};
};
var sledeci = napravi(1);
var sledeciOd10 = napravi(10);
console.log(sledeci(5.2));
console.log(sledeciOd10(2.234));
Or, Coding by Composing
var compose = function(f, g) {
return function(x) {
return f(g(x));
};
};
var toUpperCase = function(x) {
return x.toUpperCase();
};
var exclaim = function(x) {
return x + '!';
};
var shout = compose(exclaim, toUpperCase);
console.log(shout("samo linux web server"));
//=> "SAMO LINUX WEB SERVER!"