Ordered sequences, based on scalaz.FingerTree
a
has a higher priority than b
if Order[A].greaterThan(a, b)
.
insert
and ++
maintains the ordering.
The measure is calculated with a Semigroup[A @@ LastVal]
, whose append
operation favours the first argument. Accordingly, the measure of a node is the
item with the highest priority contained recursively below that node.
- Companion
- object
Value members
Abstract methods
Fold over the structure of the tree. The given functions correspond to the three possible variations of the finger tree.
Fold over the structure of the tree. The given functions correspond to the three possible variations of the finger tree.
- Value Params
- deep
otherwise, convert the measure, the two fingers, and the sub tree to a
B
.- empty
value to return if the tree is empty
- single
if the tree contains a single element, convert the measure and this element to a
B
Concrete methods
Append xs
to this sequence, reordering elements to
Append xs
to this sequence, reordering elements to
Prepends an element to the left of the tree. O(1).
Prepends an element to the left of the tree. O(1).
Appends an element to the right of the tree. O(1).
Appends an element to the right of the tree. O(1).
Replace the last element of the tree with the given value. O(1)
Replace the last element of the tree with the given value. O(1)
Appends the given finger tree to the right of this tree.
Appends the given finger tree to the right of this tree.
Execute the provided side effect for each element in the tree.
Execute the provided side effect for each element in the tree.
Selects the first element in the tree.
Selects the first element in the tree.
- Throws
- if
the tree is empty
Selects a subtree containing all elements except the last
Selects a subtree containing all elements except the last
- Throws
- if
the tree is empty
Insert a
at a the first point that all elements to the left are of higher priority
Insert a
at a the first point that all elements to the left are of higher priority
An iterator that visits each element in the tree.
An iterator that visits each element in the tree.
Selects the last element in the tree.
Selects the last element in the tree.
- Throws
- if
the tree is empty
Maps the given function across the tree, annotating nodes in the resulting tree according to the provided Reducer
.
Maps the given function across the tree, annotating nodes in the resulting tree according to the provided Reducer
.
- Returns
(higher, lowerOrEqual) The sub-sequences that contain elements of higher and of lower-than-or-equal priority than
a
, and of lower or equal priority respectively.
Convert the leaves of the tree to an M
Convert the leaves of the tree to an M
An iterator that visits each element in the tree in reverse order.
An iterator that visits each element in the tree in reverse order.
Splits this tree into a pair of subtrees at the point where the given predicate, based on the measure,
changes from false
to true
. O(log(min(i,n-i)))
Splits this tree into a pair of subtrees at the point where the given predicate, based on the measure,
changes from false
to true
. O(log(min(i,n-i)))
- Value Params
- pred
predicate on node measures. Must be a semigroup homomorphism from the semigroup
V
of node measures to the semigroup ofBoolean
s with||
as the semigroup operation. Namely, it must hold thatpred(v1 |+| v2) = pred(v1) || pred(v2)
.
- Returns
(as, bs)
, where -as
: the subtree containing elements before the point wherepred
first holds -bs
: the subtree containing elements at and after the point wherepred
first holds. Empty ifpred
never holds.
Like split
, but returns the element where pred
first holds separately
Like split
, but returns the element where pred
first holds separately
- Throws
- if
the tree is empty.
Selects a subtree containing all elements except the first
Selects a subtree containing all elements except the first
- Throws
- if
the tree is empty
Convert the leaves of the tree to an F[A]
Convert the leaves of the tree to an F[A]
Convert the leaves of the tree to a scalaz.IList
Convert the leaves of the tree to a scalaz.IList
Convert the leaves of the tree to a scala.LazyList
Convert the leaves of the tree to a scala.LazyList
Convert the leaves of the tree to a scala.List
Convert the leaves of the tree to a scala.List
Like traverse, but with a more constraint type: we need the additional measure to construct the new tree.
Like traverse, but with a more constraint type: we need the additional measure to construct the new tree.
Replace the first element of the tree with the given value. O(1)
Replace the first element of the tree with the given value. O(1)