Teodorico Levoff
Teodorico Levoff

Reputation: 1659

Why is the function curry called curry?

In many list processing languages (and other languages as well) they have a function called curry, which does some neat things. My question is why do they call it curry? Where does this name come from? My only guess would be the tasty curry dishes from various countries in the world but I can't see any relation with this and the functions behaviour.

Upvotes: 20

Views: 1920

Answers (2)

MisterMetaphor
MisterMetaphor

Reputation: 6018

The concept itself is named after Haskell Curry, who developed it.

Currying is basically translating a function of N arguments to a 'tree' of N nested functions, each taking one argument.

In Haskell, the curry function converts a function of two arguments to a function of one argument that returns another function of one argument, which will finally return the result. It has the type:

curry :: ((a, b) -> c) -> a -> b -> c

Its implementation is shorter than the type definition:

curry f x y =  f (x, y)

Upvotes: 8

SLaks
SLaks

Reputation: 887987

It's named after Haskell Curry, who worked on the mathematical foundations of functional programming.

Upvotes: 30

Related Questions