Search⌘ K

Combining Currying and Composition

Learn how to use currying and composition together for functions that take multiple arguments.

Function with one parameter value

Composing is easy when we have a scenario like this:

  • Function ONE accepts a parameter of type A and returns a value of type B.
  • Function TWO accepts a parameter of type B and returns a value of type C.
  • Function THREE accepts a parameter of type C and returns a value of type D.

Note how function TWO needs a value that function ONE can provide, while function THREE needs a value produced by function TWO. This means that these functions can be ...