//result = 3*x + 5;
var Mul3 = function(x){
return 3*x;
}
var Add5 = function(x){
return x + 5;
} var Result = function(Mul,Add){
return function(x){
return Add(Mul(x));
};
} Result(Mul3,Add5)(1);//8
引用文献:
http://www.ruanyifeng.com/blog/2017/02/fp-tutorial.html
https://llh911001.gitbooks.io/mostly-adequate-guide-chinese/content/ch2.html#为何钟爱一等公民
https://zhuanlan.zhihu.com/p/21714695