Foldable
trait Foldable[t: Type -> Type]
SourceA trait for data structures that can be folded.
Signatures
Left-associative fold of a structure.
Applies f
to a start value s
and all elements in t
going from left to right.
Trait Definitions
Returns the number of elements in t
that satisfy the predicate f
.
Returns t
without the longest prefix that satisfies the predicate f
.
Returns an immutable list.
Returns true
if and only if at least one element in t
satisfies the predicate f
.
Returns false
if t
is empty.
Returns an immutable list of all the elements in t
that satisfy the predicate f
.
Optionally returns the first element of t
that satisfies the predicate f
when searching from left to right.
Returns None
if t
is empty.
Optionally returns the first element of t
that satisfies the predicate f
when searching from right to left.
Returns None
if t
is empty.
A monadic version of foldLeft
.
Applies the monadic f
to a start value s
and all elements in t
going
from left to right.
Returns the result of mapping each element and combining the results.
def foldRightM(f: a -> (b -> m[b] \ ef), s: b, t: t[a]): m[b] \ ef with Foldable[t], Monad[m]
SourceA monadic version of foldRight
.
Applies the monadic f
to a start value s
and all elements in t
going
from right to left.
Returns true
if and only if all elements in t
satisfy the predicate f
.
Returns true
if t
is empty.
Applies f
to each element in t
.
A monadic version of forEach
.
Apply f
to every value in t
. f
is applied for its monadic effect,
the answer it produces is discarded.
Optionally returns the first element of t
.
Returns None
if t
is empty.
Returns the concatenation of the string representation
of each element in t
with sep
inserted between each element.
Returns the concatenation of the string representation
of each element in t
according to f
with sep
inserted between each element.
Optionally returns the last element of t
.
Returns None
if t
is empty.
Optionally finds the largest element of t
according to the Order
on a
.
Returns None
if t
is empty.
Optionally finds the largest element of t
according to the given comparator cmp
.
Returns None
if t
is empty.
Returns true
if and only if the element x
is in t
.
Optionally finds the smallest element of t
according to the Order
on a
.
Returns None
if t
is empty.
Optionally finds the smallest element of t
according to the given comparator cmp
.
Returns None
if t
is empty.
Optionally applies f
to all elements in t
going from left to right until a single value is obtained.
Returns None
if t
is empty.
Optionally applies f
to all elements in t
going from right to left until a single value is obtained.
Returns None
if t
is empty.
Returns the sum of all elements in t
according to the function f
.
Returns the longest prefix of t
that satisfies the predicate f
.
Returns an immutable list.
Returns t
as a DelayMap
Returns a map with elements of s
as keys and f
applied as values.
Returns t
as a MutDeque
.
Returns t
as a mutable list.
Returns t
as a MutMap
.
Returns the set s
as a MutSet
.
Optionally returns t
as a non empty chain.