Headline

Map a tuple of sequences into a sequence of tuples

Illustration

In Language:Haskell, the basic zip function is of the following type:

> :t zip
zip :: [a] -> [b] -> [(a, b)]

Thus, the zip function takes two lists of possibly different element types and returns a list of pairs. Here is an illustrative application of zip to build pairs of characters with associated ASCII codes:

> zip ['A','B','C'] [65,66,67]
[('A',65),('B',66),('C',67)]

There exist further variation on zipping. For instance, there is also a zipWith function which applies an argument function to pairs rather than constructing pairs. For instance, consider two lists of operands for addition; pairwise addition can be applied as follows:

> :t zipWith
zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]
> zipWith (+) [1,2,3] [4,5,6] 
[5,7,9]

For what it matters, the basic zip function is defined as follows:

zip :: [a] -> [b] -> [(a, b)]
zip = zipWith (,) -- apply pair construction


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.