A linked-list of elements. The list is composed of element container objects

that are chained together. It is optimized so that adding or removing an

element does not imply copying the whole list content every time.


Can be created as:

Lib.Sys.List.new()

creates list object



Created List objects has properties:

length

The length of this List.



and methods:

add(item)

Adds element item at the end of this List.

.length increases by 1.

item - new list element

clear()

Empties this List.

This function does not traverse the elements, but simply sets the internal references to nil and .length to 0.


filter(f)

Returns a list filtered with f. The returned list will contain all elements for which f(x) == true.

f - filter function

first()

Returns the first element of this List, or nil if no elements exist.

This function does not modify this List.


isEmpty()

Tells if this List is empty.


iterator()

Returns an iterator on the elements of the list.


join(sep)

Returns a string representation of this List, with sep separating each element.

sep - separation string

last()

Returns the last element of this List, or nil if no elements exist.

This function does not modify this List.


map(f)

Returns a new list where all elements have been converted by the function f.

f - convertion function

pop()

Returns the first element of this List, or nil if no elements exist.

The element is removed from this List.


push(item)

Adds element item at the beginning of this List.

.length increases by 1.

item - new list element

remove(v)

Removes the first occurrence of v in this List.

If v is found by checking standard equality, it is removed from this List and the function returns true.

Otherwise, false is returned.

v - list item

toString()

Returns a string representation of this List.

The result is enclosed in { } with the individual elements being separated by a comma.


Created with the Personal Edition of HelpNDoc: Full-featured EPub generator