These are trees representing sequences that have the following properties:
each node is either a Zero, Single, Chunk or <>
Zero represents an empty tree and is a leaf at level 0
Single represents a tree with a single element and is a leaf at level 0
Chunk represents many elements with a single node and is a leaf at level 0
<> represents an internal node -- it has a left and a right child
<> is at level math.max(left.level, right.level) + 1
<> is such that math.abs(right.level - left.level) <= 1
Note that the last property ensures that the tree is balanced.
Chunk nodes can be used for the conc lists to serve as ropes.
Note that these ropes are balanced only if the chunk sizes differ up to a constant factor.
Generalized conc-lists.
These are trees representing sequences that have the following properties:
Zero,Single,Chunkor<>Zerorepresents an empty tree and is a leaf at level 0Singlerepresents a tree with a single element and is a leaf at level 0Chunkrepresents many elements with a single node and is a leaf at level 0<>represents an internal node -- it has aleftand arightchild<>is at levelmath.max(left.level, right.level) + 1<>is such thatmath.abs(right.level - left.level) <= 1Note that the last property ensures that the tree is balanced.
Chunknodes can be used for the conc lists to serve as ropes. Note that these ropes are balanced only if the chunk sizes differ up to a constant factor.