Headline

Apply a function to some but not all arguments

Illustration

Here is an example of "non-partial" application of addition in Language:Haskell:

> 41 + 1
42

In this example, we actually increment 41. Let us thus define the increment function as a partial application of addition so that we can model the same computation as follows:

> let inc = (+) 1
> inc 41
42

It is important that "+" was surrounded by "(...)" because "+" is an infix operator and we need to use in an prefix manner when aiming at partial application. The notation "(+)" does indeed produce a prefix operator.

In Haskell, sections for infix operators correspond to a special form of partial application. A section applies an infix operator to one of its two operands by using parenthesization in the following way:

> let inc = (+1)
> inc 41
42

In this example, we have applied "+" to its second operand. For what it matters (and because addition is commutative), we could also define the increment function in terms of a section for the first operand:

> let inc = (1+)
> inc 41
42

Discussion

In languages with type-level functions such as parametrized type synonyms or data types, e.g., Language:Haskell, partial application makes sense at the type level as well.

Metadata


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.