const apply1 = f => f(1); // 함수를 인자 값으로 받아서 실행(고차함수!)
const add2 = a => a+2;
console.log(apply1(add2)); // 3
const times = (f, n) => {
let i = -1;
while(++i < n) f(i);
}
times(log, 3); // 0, 1, 2(결과)
이러한 프로그래밍을 applicative programming이라 함.
const addMaker = a => b => a+b; // addMaker는 closure를 return 하는 함수.
const add10 = addMaker(10);
log(add10(5)); // 15
log(add10(10)); // 20