函数式编程游乐场
在 ES6 中玩弄函数式编程
撰写
组合 0->Infinity 函数
import compose from '../src/compose';
var square = x => x * x,
half = x => x / 2,
x2 = x => 2 * x,
squareThenHalf = compose(square, half),
doubleThenSquareThenHalf = compose(x2, square, half);
squareThenHalf(10); // 50
doubleThenSquareThenHalf(3); // 18
1