Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the value of currying in Functional Programming?

I know the concept and how to use of currying, but I wonder what is its value in practice?

like image 405
Hesey Avatar asked Jul 06 '11 07:07

Hesey


1 Answers

As the related question covers, Practical use of curried functions? , there are many reasons why people value currying and make use of it, including:

  • improving code reuse -- special case functions are simply partially-applied (and curried) generic functions
  • improving code readability -- map (+2) is easier to read than map (\x -> x + 2)
  • improved performance -- currying can make obvious certain specializations, and a good compiler will generate the specialized version for you
  • fun -- simpler code , more beautiful code makes life more enjoyable.
like image 80
Don Stewart Avatar answered Sep 29 '22 05:09

Don Stewart