Modules index


Array

This module provides an efficient mechanism for storing and manipulating large numbers of primitive machine types.

class Array:
Array objects are created by calling the following function on the Array class object:

func new(type, d := null): Creates an array of the type specified by type:
fArray of floats (size determined by architecture / OS).
iArray of integers (size determined by architecture / OS).
i32Array of 32-bit integers.
i64Array of 64-bit integers.
If d is not null, it is taken to be a string representing the underlying data and which is added to the array via extend_from_string.

Array objects support the following functions:

func append(o): Adds o to the end of the array. o must be of an appropriate type and value for this array.

func extend(c): Appends each element returned by c.iter().

func extend_from_string(s): Extends this array with data from string which is assumed to be a raw representation of this arrays' data type. s.len() must be a multiple of this arrays' data type.

func get(i): Returns the element at position i, raising an exception if i is out of bounds.

func get_slice(lower := 0, upper := self.len()): Returns a sub-array of the elements from position lower (inclusive) to upper (exclusive). An exception is raised if either index is out of bounds.


cvd_to_html ©2006-2007 Laurence Tratt