# Currying

Transformation of a function on multiple arguments to take one at a time

## Illustration

In Language:Haskell, functions are typically in curried form. Consider, for example, the signature of addition:

> :t (+)
(+) :: Num a => a -> a -> a

Curried form is generally convenient as it directly enables partial application. For instance, we can define an increment function, just by passing one argument to addition:

inc :: Int -> Int
inc = (+) 1

If we were to define addition in uncurried form, then this would look as follows:

add :: Num a => (a, a) -> a

We can easily perform currying:

add' :: Num a => a -> a -> a

In fact, the currying transformation can be represented by the following higher-order function:

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

(We would need such a curry(ing) function for each number of arguments.) Thus, we can express the currying transformation as follows:

add'' :: Num a => a -> a -> a

## Relationships

See uncurrying for the dual transformation.

## Citation

(http://en.wikipedia.org/wiki/Currying, 18 May 2013)

In mathematics and computer science, currying is the technique of transforming a function that takes multiple arguments (or a tuple of arguments) in such a way that it can be called as a chain of functions, each with a single argument (partial application). It was originated by Moses Schönfinkel ... and later re-discovered by Haskell Curry.

this

## User contributions

This user never has never made submissions.

## Syntax for editing wiki

For you are available next options:

will make text bold.

will make text italic.

will make text underlined.

will make text striked.

will allow you to paste code headline into the page.

will allow you to link into the page.

will allow you to paste code with syntax highlight into the page. You will need to define used programming language.

will allow you to paste image into the page.

is list with bullets.

is list with numbers.

will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.

will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.

will allow your to insert code snippets from @worker.

## Syntax for editing wiki

For you are available next options:

will make text bold.

will make text italic.

will make text underlined.

will make text striked.

will allow you to paste code headline into the page.

will allow you to link into the page.

will allow you to paste code with syntax highlight into the page. You will need to define used programming language.

will allow you to paste image into the page.

is list with bullets.

is list with numbers.

will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.

will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.

will allow your to insert code snippets from @worker.