Function Currying

Function Currying

Introduction

  1. Named after the scientist Haskell B Curry
  2. It is a concept from lambda calculus
  3. Currying will convert a function with multiple parameters into a function with single parameters and will perform a series of unary operations
  4. Currying makes the code more concise and easy to read

How to achieve currying

  1. Currying can be achieved in two ways

     a. Using closure
    
  2. We know that in closure the outer function scope is present till the innermost function, we can use this knowledge for our benefit

  3. As functions are first-class objects we can return nested functions , we can leverage this to our benefit
    b. Using bind, apply method