Headline

Transformation of a function to take its multiple arguments at once

Illustration

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

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

Thus, addition takes one argument at a time. If we were to define addition in uncurried form, then this would look as follows:

add :: Num a => (a, a) -> a
add (x,y) = x + y

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

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

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

add' :: Num a => (a, a) -> a
add' = uncurry (+)

Relationships

See currying for the dual transformation.

Citation

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

Uncurrying is the dual transformation to currying, and can be seen as a form of defunctionalization. It takes a function f(x) which returns another function g(y) as a result, and yields a new function f′(x,y) which takes a number of additional parameters and applies them to the function returned by function f.


There are no revisions for this page.

User contributions

    This user never has never made submissions.

    User edits

    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.