1.30Class List

Fast growable double linked list.

Class List( ... ) from \
                 Sequence( ... )
... An arbitrary list of parameters.

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
lenReturns the number of items stored in the Sequence.
popRemoves the last item from the list (and returns it).
popFrontRemoves the first item from the list (and returns it).
pushAppends given item to the end of the list.
pushFrontPushes an item in front of the list.
Methods inherited from class Sequence
appendAdds an item at the end of the sequence.
backReturns the last item in the Sequence.
clearRemoves all the items from the Sequence.
compAppends elements to this sequence through a filter.
emptyChecks if the Sequence is empty or not.
firstReturns an iterator to the first element of the Sequence.
frontReturns the first item in the Sequence.
lastReturns an iterator to the last element of the Sequence.
mcompAppends elements to this sequence from multiple sources.
mfcompAppends elements to this sequence from multiple sources through a filter.
prependAdds an item in front of the sequence

Methods

len

Returns the number of items stored in the Sequence.

List.len()
ReturnCount of items in the Sequence.

pop

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

List.pop()
ReturnThe last item in the list.
Raise
AccessError if 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()
ReturnThe first item in the list.
Raise
AccessError if 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 )
item The item to be pushed.

pushFront

Pushes an item in front of the list.

List.pushFront( item )
item The item to be pushed.
Made with http://www.falconpl.org