Fast growable double linked list.
class List( ... ) \ from Sequence( ... )
init | Fast growable double linked list. |
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. |
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. |
prepend from Sequence | Adds an item in front of the sequence |
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.
Fast growable double linked list.
init List( ... )
... | 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.
Returns the number of items stored in the Sequence.
List.len( )
Returns: | Count of items in the Sequence. |
Removes the last item from the list (and returns it).
List.pop( )
Returns: | The last item in the list. | ||
Raises: |
|
Removes the last item from the list (and returns it). If the list is empty, an access exception is raised.
Removes the first item from the list (and returns it).
List.popFront( )
Returns: | The first item in the list. | ||
Raises: |
|
Removes the first item from the list (and returns it). If the list is empty, an access exception is raised.
Appends given item to the end of the list.
List.push( item )
item | The item to be pushed. |
Pushes an item in front of the list.
List.pushFront( item )
item | The item to be pushed. |