Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Vienna Development Method
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==== Sequences ==== The finite sequence type constructor (written <code>seq of T</code> where <code>T</code> is a predefined type) constructs the type composed of all finite lists of values drawn from the type <code>T</code>. For example, the type definition <syntaxhighlight lang="rsl"> String = seq of char </syntaxhighlight> Defines a type <code>String</code> composed of all finite strings of characters. Various operators are defined on sequences for constructing concatenation, selection of elements and subsequences etc. Many of these operators are partial in the sense that they are not defined for certain applications. For example, selecting the 5th element of a sequence that contains only three elements is undefined. The order and repetition of items in a sequence is significant, so <code>[a, b]</code> is not equal to <code>[b, a]</code>, and <code>[a]</code> is not equal to <code>[a, a]</code>. {| border="1" class="wikitable" |+ style="background:#ffdead;" |Main operators on sequences (s, s1,s2 are sequences) |- | <code>[a, b, c]</code> || Sequence enumeration: the sequence of elements <code>a</code>, <code>b</code> and <code>c</code> |- | <code><nowiki>[f(x) | x:T & P(x)]</nowiki></code> || Sequence comprehension: sequence of expressions <code>f(x)</code> for each <code>x</code> of (numeric) type <code>T</code> such that <code>P(x)</code> holds <br />(<code>x</code> values taken in numeric order) |- | <code>hd s</code> || The head (first element) of <code>s</code> |- | <code>tl s</code> || The tail (remaining sequence after head is removed) of <code>s</code> |- | <code>len s</code> || The length of <code>s</code> |- | <code>elems s</code> || The set of elements of <code>s</code> |- | <code>s(i)</code> || The <code>i</code><sup>th</sup> element of <code>s</code> |- | <code>inds s</code> || the set of indices for the sequence <code>s</code> |- | <code>s1^s2</code> || the sequence formed by concatenating sequences <code>s1</code> and <code>s2</code> |}
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Vienna Development Method
(section)
Add topic