by devwebee · 12y ago · 0 comments
var multiply = curry(function(x, y){
return x * y;
});
var add = curry(function(x, y){
return x + y;
});
var Calc = (function(){
function Calc(x){
this.x = x;
}
Calc.prototype.map = function(f){
this.x = f(this.x);
return this;
};
return Calc;
}());
new Calc(2).map(compose(add(2), multiply(4)));
// or
new Calc(2).map(multiply(4)).map(add(2));No comments yet.