Modifier and Type | Method and Description |
---|---|
abstract <B> B |
foldLeft(F<B,F<A,B>> f,
B z)
Folds this digit to the left using the given function and the given initial value.
|
abstract <B> B |
foldRight(F<A,F<B,B>> f,
B z)
Folds this digit to the right using the given function and the given initial value.
|
abstract int |
length() |
abstract P2<java.lang.Integer,A> |
lookup(F<V,java.lang.Integer> o,
int i) |
<B> Digit<V,B> |
map(F<A,B> f,
Measured<V,B> m)
Maps a function across the elements of this digit, measuring with the given measurement.
|
abstract <B> B |
match(F<One<V,A>,B> one,
F<Two<V,A>,B> two,
F<Three<V,A>,B> three,
F<Four<V,A>,B> four)
Structural pattern matching on digits.
|
V |
measure()
Returns the sum of the measurements of this digit according to the monoid.
|
A |
reduceLeft(F<A,F<A,A>> f)
Folds this digit to the right using the given function.
|
A |
reduceRight(F<A,F<A,A>> f)
Folds this digit to the right using the given function.
|
abstract Stream<A> |
toStream() |
java.lang.String |
toString() |
FingerTree<V,A> |
toTree()
Returns the tree representation of this digit.
|
public abstract <B> B foldRight(F<A,F<B,B>> f, B z)
f
- A function with which to fold this digit.z
- An initial value to apply at the rightmost end of the fold.public abstract <B> B foldLeft(F<B,F<A,B>> f, B z)
f
- A function with which to fold this digit.z
- An initial value to apply at the leftmost end of the fold.public final A reduceRight(F<A,F<A,A>> f)
f
- A function with which to fold this digit.public final A reduceLeft(F<A,F<A,A>> f)
f
- A function with which to fold this digit.public final <B> Digit<V,B> map(F<A,B> f, Measured<V,B> m)
f
- A function to map across the elements of this digit.m
- A measuring for the function's domain (destination type).public abstract <B> B match(F<One<V,A>,B> one, F<Two<V,A>,B> two, F<Three<V,A>,B> three, F<Four<V,A>,B> four)
one
- A function to apply to this digit if it's One.two
- A function to apply to this digit if it's Two.three
- A function to apply to this digit if it's Three.four
- A function to apply to this digit if it's Four.public final V measure()
public final FingerTree<V,A> toTree()
public abstract int length()
public java.lang.String toString()
toString
in class java.lang.Object