Concept:
Function composition
Headline
Apply two functions, one after another
Description
Function composition is a fundamental operation on functions so that they are applied one after another. That is the composition of f and g when applied to an argument x is the same as first computing the result y of applying g to x and then applying f to y.
Illustration
Function composition in Haskell
Let's assume the following function:
-- Test an Int to be even
even :: Int -> Bool
even x = x `mod` 2 == 0
The test for a number to be odd can be trivially described by composing even and logical negation. In Language:Haskell, function composition is denoted by the infix operator ".". Thus:
-- Test an Int to be odd
odd :: Int -> Bool
odd = not . even
We can always replace function composition by some pattern of function application. For instance, odd could also be expressed like this:
-- Test an Int to be odd
odd' :: Int -> Bool
odd' x = not (even x)
There are no revisions for this page.
User contributions
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.