Class List

Fast growable double linked list.

class List( ... ) \ from Sequence( ... )

more...

Summary

len()Returns the number of items stored in the Sequence.
pop()Removes the last item from the list (and returns it).
popFront()Removes the first item from the list (and returns it).
push()Appends given item to the end of the list.
pushFront()Pushes an item in front of the list.

Inherited methods

append from Sequence Adds an item at the end of the sequence.
back from Sequence Returns the last item in the Sequence.
clear from Sequence Removes all the items from the Sequence.
comp from Sequence Appends elements to this sequence through a filter.
empty from Sequence Checks if the Sequence is empty or not.
first from Sequence Returns an iterator to the first element of the Sequence.
front from Sequence Returns the first item in the Sequence.
last from Sequence Returns an iterator to the last element of the Sequence.
mcomp from Sequence Appends elements to this sequence from multiple sources.
mfcomp from Sequence Appends elements to this sequence from multiple sources through a filter.
prepend from Sequence Adds an item in front of the sequence

Detailed description

class List( ... ) \ from Sequence( ... )

...An arbitrary list of parameters.

Fast growable double linked list.

The list class implements a double linked list of generic Falcon items that has some hooking with the falcon VM. Particularly, instances of the List class can be used as parameters for the Iterator constructor, or an iterator can be generated for them using first() and last() BOM methods. Also, instances of the List class can be used as any other sequence in for/in loops.

For example, the following code:

 descr = List("blue", "red", "gray", "purple")

for color in descr
forfirst
   >> "Grues are ", color
   continue
end
formiddle: >> ", ", color
forlast: > " and ", color, "."
end

prints:

 Grues are blue, red, gray and purple.

Methods

len()

Returns the number of items stored in the Sequence.

List.len( )

Returns:Count of items in the Sequence.

pop()

Removes the last item from the list (and returns it).

List.pop( )

Returns:The last item in the list.
Raises:
AccessErrorif the list is empty.

Removes the last item from the list (and returns it). If the list is empty, an access exception is raised.

popFront()

Removes the first item from the list (and returns it).

List.popFront( )

Returns:The first item in the list.
Raises:
AccessErrorif the list is empty.

Removes the first item from the list (and returns it). If the list is empty, an access exception is raised.

push()

Appends given item to the end of the list.

List.push( item )

itemThe item to be pushed.

pushFront()

Pushes an item in front of the list.

List.pushFront( item )

itemThe item to be pushed.

Made with faldoc 2.2.0