Concept:
Immutable tuple
Headline
An order collection of values without basic operations for mutation
Description
An immutable tuple is a data structure for ordered collections of elements of possibly different types. An immutable tuple can be manipulated in a basic sense like this:
- Projection: access the i-th component of the tuple.
- Construction: compose a tuple from the components.
Tuples of length 2 are also called pairs.
Tuples of length 3 are also called triples.
Illustration
Pairs in Haskell
Pairs are constructed as follows.
> ("four",2)
("four",2)
> (4, 2)
(4,2)
Projection is applied as follows.
> fst ("four",2)
"four"
> snd (4, 2)
2
There are designated tuple types:
> :t ('x', 'x')
('x', 'x') :: (Char, Char)
> :t ('x', True)
('x', True) :: (Char, Bool)
Tuples of other lengths can be manipulated and typed accordingly.
Backlinks
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.