강의

멘토링

로드맵

Inflearn Community Q&A

milban's profile image
milban

asked

Functional Programming and JavaScript ES6+

Total quantity, total price

curry를 이용하지 않고 작성해봤는데, 이런방식도 괜찮나용?

Resolved

Written on

·

291

1

const sum = (f) => pipe(
    map(f),
    reduce(add),
  );

  const total_quantity = sum(
    p => p.quantity
  );

  log(total_quantity(products));

  const total_price = sum(
    p => p.price * p.quantity
  );

  log(total_price(products));
javascript함수형-프로그래밍

Answer 1

1

mduniv님의 프로필 이미지
mduniv
Instructor

그럼요 :) 

명시적으로 단항 함수를 만드는 것은 정적 검사 도구나 IDE 의 도움을 더 잘 받을 수 있다는 장점이 있습니다 :)

milban's profile image
milban

asked

Ask a question