next up previous contents
Next: Stacks Up: Sequences Previous: Cords   Contents

Extensible and Sorted Sequences

An ExtensibleSequence is an extensible Sequence with some special methods to treat both ends as queues. It provides the following additional protocol:

addFirst:
inserts the given object at the beginning of the sequence.
addLast:
inserts the given object at the end of the sequence.
add:
inserts the given object at the end of the sequence (it's addLast:).
first:
answers a sequence of the first N elements.
last:
answers a sequence of the final N elements.
removeFirst
removes the first element from the sequence.
removeLast
removes the final element from the sequence.
A SortedSequence behaves similarly except that it will arrange for its members to remain sorted according to a block closure that compares two individual elements; as a result, it should not be manipulated except via add: and remove: since it maintains its own ordering. A Heap is a SortedSequence designed for collecting elements in arbitrary order, and removing the first elements.



Brian Rice 2004-08-24