mediumJS ES5#143

curry and compose

Prompt

Two functional-programming staples:

  1. curry(fn) — collects arguments across calls (f(1)(2), f(1, 2), f(1)(2, 3) all work) and invokes fn once it has fn.length of them
  2. compose(...fns) — right-to-left composition: compose(f, g)(x) === f(g(x))

Hints

Solution

Your Code

15 min

Tests

Click Run to test your code