Seed7 - The extensible programming language
Seed7 FAQ Manual Screenshots Examples Libraries Algorithms Download Links
Libraries AES ARC4 Array ASN.1 Bigfile Bigint Bigrat Bin32 Bin64 Bitdata Bitmapfont Bitset Bitsetof Boolean Browser Bstring Bytedata Cards Category CC config Cgi Cgi dialog Char Charsets Cipher Clib_file Color CLI Commands Complex Console Crc32 Deflate DES Dialog Dir Draw Duration Echo Editline Enable_input Enable_io Enable_output Encoding Environment External_file File File system Float Font Forloop Ftp Getf Gethttp Gethttps Graph Graph_file Gzip Hash Hashsetof Hmac Html_ent Httpserv Idxarray Image Inflate Inflate file Inifile Integer Keybd Line Listener LZW Make Math Msgdigest Null_file Osfiles Picture utility Pixmap_file Pixmapfont PKCS #1 Poll Process Progs Propertyfile Rational Reference Ref_list Scanfile Scanstri Set Shell Smtp Sockbase Socket SQL base Stdio Strifile String Stritext Subrange Tar Text Time TLS/SSL Triple DES Unicode Utf16 Utf8 Vectorfont 3D Vector Window Wrinum X.509 Xmldom Xml_ent Zip
Libraries
Array Source Code
 previous   up   next 

Abstract data types
type
array (in type: baseType)
Abstract data type, describing resizeable arrays with integer index.

array

const func type: array (in type: baseType)

Abstract data type, describing resizeable arrays with integer index. Arrays with non-integer index are described in idxarray.


Operator Summary
void
(inout arrayType: arr) &:= (in arrayType: extension)
Append the array extension to the array arr.
void
(inout arrayType: arr) &:= (in baseType: element)
Append the given element to the array arr.
arrayType
(in arrayType: arr1) & (in arrayType: arr2)
Concatenate two arrays.
baseType
(in arrayType: arr) [ (in integer: index) ]
Access one element from the array arr.
arrayType
(in arrayType: arr) [ (in integer: start) .. ]
Get a sub array beginning at the position start.
arrayType
(in arrayType: arr) [ .. (in integer: stop) ]
Get a sub array ending at the position stop.
arrayType
(in arrayType: arr) [ (in integer: start) .. (in integer: stop) ]
Get a sub array from the position start to the position stop.
arrayType
(in arrayType: arr) [ (in integer: start) len (in integer: length) ]
Get a sub array from the position start with maximum length len.
arrayType
(in integer: factor) times (in baseType: element)
Generate an array by using factor elements.
arrayType
(in ARRAY_IDX_RANGE: indexRange) times (in baseType: element)
Generate an array of elements with indices in a specified range.

Function Summary
baseType
remove (inout arrayType: arr, in integer: index)
Remove the element with index from arr and return the removed element.
integer
length (in arrayType: arr)
Determine the length of the array arr.
integer
minIdx (in arrayType: arr)
Minimal index of array arr.
integer
maxIdx (in arrayType: arr)
Maximal index of array arr.
void
for (inout baseType: forVar) range (in arrayType: arr) do (in proc: statements) end for
For-loop where forVar loops over the elements of the array arr.
void
for key (inout integer: keyVar) range (in arrayType: arr) do (in proc: statements) end for
For-loop where keyVar loops over the indices of the array arr.
void
for (inout baseType: forVar) key (inout integer: keyVar) range (in arrayType: arr) do (in proc: statements) end for
For-loop where forVar and keyVar' loop over the array arr''.
void
for (inout baseType: forVar) range (in arrayType: arr) until (ref func boolean: condition) do (in proc: statements) end for
For-loop where forVar loops over the elements of the array arr.
void
for key (inout integer: keyVar) range (in arrayType: arr) until (ref func boolean: condition) do (in proc: statements) end for
For-loop where keyVar loops over the indices of the array arr.
void
for (inout baseType: forVar) key (inout integer: keyVar) range (in arrayType: arr) until (ref func boolean: condition) do (in proc: statements) end for
For-loop where forVar and keyVar' loop over the array arr''.
baseType
rand (in arrayType: arr)
Select a random element from arr.

Operator Detail

&:=

const proc: (inout arrayType: arr) &:= (in arrayType: extension)

Append the array extension to the array arr.

Raises:
MEMORY_ERROR - Not enough memory for the concatenated array.

&:=

const proc: (inout arrayType: arr) &:= (in baseType: element)

Append the given element to the array arr.

Raises:
MEMORY_ERROR - Not enough memory for the concatenated array.

&

const func arrayType: (in arrayType: arr1) & (in arrayType: arr2)

Concatenate two arrays.

Returns:
the result of the concatenation.

[

const func baseType: (in arrayType: arr) [ (in integer: index) ]

Access one element from the array arr.

Returns:
the element with the specified index from arr.
Raises:
RANGE_ERROR - When index is less than minIdx(arr) or greater than maxIdx(arr)

[

const func arrayType: (in arrayType: arr) [ (in integer: start) .. ]

Get a sub array beginning at the position start.

Returns:
the sub array beginning at the start position.
Raises:
MEMORY_ERROR - Not enough memory to represent the result.

[ ..

const func arrayType: (in arrayType: arr) [ .. (in integer: stop) ]

Get a sub array ending at the position stop.

Returns:
the sub array ending at the stop position.
Raises:
MEMORY_ERROR - Not enough memory to represent the result.

[

const func arrayType: (in arrayType: arr) [ (in integer: start) .. (in integer: stop) ]

Get a sub array from the position start to the position stop.

Returns:
the sub array from position start to stop.
Raises:
MEMORY_ERROR - Not enough memory to represent the result.

[

const func arrayType: (in arrayType: arr) [ (in integer: start) len (in integer: length) ]

Get a sub array from the position start with maximum length len.

Returns:
the sub array from position start with maximum length len.
Raises:
MEMORY_ERROR - Not enough memory to represent the result.

times

const func arrayType: (in integer: factor) times (in baseType: element)

Generate an array by using factor elements.

Returns:
an array with factor elements.
Raises:
RANGE_ERROR - When factor is negative.
MEMORY_ERROR - Not enough memory to represent the result.

times

const func arrayType: (in ARRAY_IDX_RANGE: indexRange) times (in baseType: element)

Generate an array of elements with indices in a specified range. The range is specified with a bracketed range expression like [A .. B]. An array with 5 char elements indexed from 0 to 4 is created with:

[0 .. 4] times 'x'

This is equivalent to

[0] ('x', 'x', 'x', 'x', 'x')

An empty array can be generated with

[0 .. -1] times "asdf"
Returns:
an array with B - A + 1 elements.
Raises:
RANGE_ERROR - When B - A is less than -1.
MEMORY_ERROR - Not enough memory to represent the result.

Function Detail

remove

const func baseType: remove (inout arrayType: arr, in integer: index)

Remove the element with index from arr and return the removed element.

Returns:
the removed element.
Raises:
RANGE_ERROR - When index is less than minIdx(arr) or greater than maxIdx(arr)

length

const func integer: length (in arrayType: arr)

Determine the length of the array arr.

Returns:
the length of the array.

minIdx

const func integer: minIdx (in arrayType: arr)

Minimal index of array arr.

Returns:
the minimal index of the array.

maxIdx

const func integer: maxIdx (in arrayType: arr)

Maximal index of array arr.

Returns:
the maximal index of the array.

for

const proc: for (inout baseType: forVar) range (in arrayType: arr) do (in proc: statements) end for

For-loop where forVar loops over the elements of the array arr.


for key

const proc: for key (inout integer: keyVar) range (in arrayType: arr) do (in proc: statements) end for

For-loop where keyVar loops over the indices of the array arr.


for

const proc: for (inout baseType: forVar) key (inout integer: keyVar) range (in arrayType: arr) do (in proc: statements) end for

For-loop where forVar and keyVar' loop over the array arr''.


for

const proc: for (inout baseType: forVar) range (in arrayType: arr) until (ref func boolean: condition) do (in proc: statements) end for

For-loop where forVar loops over the elements of the array arr. Additionally a condition is checked before the statements in the loop body are executed.


for key

const proc: for key (inout integer: keyVar) range (in arrayType: arr) until (ref func boolean: condition) do (in proc: statements) end for

For-loop where keyVar loops over the indices of the array arr. Additionally a condition is checked before the statements in the loop body are executed.


for

const proc: for (inout baseType: forVar) key (inout integer: keyVar) range (in arrayType: arr) until (ref func boolean: condition) do (in proc: statements) end for

For-loop where forVar and keyVar' loop over the array arr''. Additionally a condition is checked before the statements in the loop body are executed.


rand

const func baseType: rand (in arrayType: arr)

Select a random element from arr. The pseudo-random indices of the elements are uniform distributed.

Returns:
a random element from arr.
Raises:
RANGE_ERROR - When arr is empty.


 previous   up   next