DelayMap
case DMap(RedBlackTree[k, Lazy[v]])
Instances
Definitions
@Experimental @LazyWhenPure
Updates m
with k => f(v)
if k => v
is in m
. Otherwise, returns m
.
Purity reflective: Applies f
lazily if f
is pure.
@Experimental @LazyWhenPure
def adjustWithKey(f: k -> (v -> v \ ef), k: k, m: DelayMap[k, v]): DelayMap[k, v] \ ef with Order[k]
SourceUpdates m
with k => f(k, v)
if k => v
is in m
. Otherwise, returns m
.
Purity reflective: Applies f
lazily if f
is pure.
@Experimental @ParallelWhenPure
def count(f: k -> (v -> Bool \ ef), m: DelayMap[k, v]): Int32 \ ef
SourceReturns the number of mappings k => v
in m
that satisfy the predicate f
.
Purity reflective: Runs in parallel when given a pure function f
.
@Experimental
Returns a map of all mappings k => v
in m
where v
satisfies the predicate f
.
@Experimental
def filterWithKey(f: k -> (v -> Bool \ ef), m: DelayMap[k, v]): DelayMap[k, v] \ ef with Order[k]
SourceReturns a map of all mappings k => v
in m
where (k, v)
satisfies the predicate f
.
@Experimental
def foldLeft(f: b -> (v -> b \ ef), s: b, m: DelayMap[k, v]): b \ ef
SourceApplies f
to a start value s
and all values in m
going from left to right.
That is, the result is of the form: f(...f(f(s, v1), v2)..., vn)
.
@Experimental
def foldLeftWithKey(f: b -> (k -> (v -> b \ ef)), s: b, m: DelayMap[k, v]): b \ ef
SourceApplies f
to a start value s
and all key-value pairs in m
going from left to right.
That is, the result is of the form: f(...f(f(s, k1, v1), k2, v2)..., vn)
.
@Experimental
def foldRight(f: v -> (b -> b \ ef), s: b, m: DelayMap[k, v]): b \ ef
SourceApplies f
to a start value s
and all values in m
going from right to left.
That is, the result is of the form: f(v1, ...f(vn-1, f(vn, s)))
.
@Experimental
def foldRightWithCont(f: v -> ((Unit -> b \ ef) -> b \ ef), z: b, m: DelayMap[k, v]): b \ ef
SourceApplies f
to a start value z
and all values in m
going from right to left.
That is, the result is of the form: f(v1, ...f(vn-1, f(vn, z)))
.
A foldRightWithCont
allows early termination by not calling the continuation.
@Experimental
def foldRightWithKey(f: k -> (v -> (b -> b \ ef)), s: b, m: DelayMap[k, v]): b \ ef
SourceApplies f
to a start value s
and all key-value pairs in m
going from right to left.
That is, the result is of the form: f(k1, v1, ...f(kn-1, vn-1, f(kn, vn, s)))
.
@Experimental
def foldRightWithKeyCont(f: k -> (v -> ((Unit -> b \ ef) -> b \ ef)), s: b, m: DelayMap[k, v]): b \ ef
SourceApplies f
to a start value s
and all key-value pairs in m
going from right to left.
That is, the result is of the form: f(k1, v1, ...f(kn-1, vn-1, f(kn, vn, s)))
.
A foldRightWithKeyCont
allows early termination by not calling the continuation.
@Experimental
def forEach(f: k -> (v -> Unit \ ef), m: DelayMap[k, v]): Unit \ ef
SourceApplies f
to every (key, value)
of m
.
@Experimental
def forEachWithIndex(f: Int32 -> (k -> (v -> Unit \ ef)), m: DelayMap[k, v]): Unit \ ef
SourceApplies f
to tuple (index, key, value)
formed of the keys and values of
DelayMap m
and the index of the traversal.
@Experimental
Returns Some(v)
if k => v
is in m
.
Otherwise returns None
.
@Experimental
Returns v
if k => v
is in m
.
Otherwise, returns d
.
@Experimental
Returns m
with k => v
.
@Experimental @LazyWhenPure
def insertWith(f: v -> (v -> v \ ef), k: k, v: v, m: DelayMap[k, v]): DelayMap[k, v] \ ef with Order[k]
SourceUpdates m
with k => f(v, v1)
if k => v1
is in m
.
Otherwise, updates m
with k => v
.
@Experimental @LazyWhenPure
def insertWithKey(f: k -> (v -> (v -> v \ ef)), k: k, v: v, m: DelayMap[k, v]): DelayMap[k, v] \ ef with Order[k]
SourceUpdates m
with k => f(k, v, v1)
if k => v1
is in m
.
Otherwise, updates m
with k => v
.
@Experimental
def isEmpty(m: DelayMap[k, v]): Bool
SourceReturns true
if and only if m
is the empty map, i.e. Map(Nil)
.
@Experimental
def iterator(rc: Region[r], m: DelayMap[a, b]): Iterator[(a, b), r, r] \ r
SourceReturns an iterator over all key-value pairs in m
.
@Experimental
Returns the concatenation of the string representation of each key k
in m
with sep
inserted between each element.
@Experimental
Returns the concatenation of the string representation of each value v
in m
with sep
inserted between each element.
@Experimental
def joinWith(f: k -> (v -> String \ ef), sep: String, m: DelayMap[k, v]): String \ ef
SourceReturns the concatenation of the string representation of each key-value pair
k => v
in m
according to f
with sep
inserted between each element.
@Experimental @ParallelWhenPure @LazyWhenPure
def map(f: v1 -> v2 \ ef, m: DelayMap[k, v1]): DelayMap[k, v2] \ ef
SourceReturns a map with mappings k => f(v)
for every k => v
in m
.
Purity reflective:
- Runs in parallel when given a pure function f
.
- Applies f
lazily if f
is pure.
@Experimental @ParallelWhenPure @LazyWhenPure
def mapWithKey(f: k -> (v1 -> v2 \ ef), m: DelayMap[k, v1]): DelayMap[k, v2] \ ef
SourceReturns a map with mappings k => f(k, v)
for every k => v
in m
.
Purity reflective:
- Runs in parallel when given a pure function f
.
- Applies f
lazily if f
is pure.
@Experimental
def maximumKey(m: DelayMap[k, v]): Option[(k, v)]
SourceOptionally finds k => v
where k
is the largest key according to the Order
instance of k
.
Returns None
if m
is empty.
@Experimental @ParallelWhenPure
def maximumKeyBy(cmp: k -> (k -> Comparison \ ef), m: DelayMap[k, v]): Option[(k, v)] \ ef
SourceOptionally finds k => v
where k
is the largest key according to the given comparator cmp
.
Returns None
if m
is empty.
Purity reflective: Runs in parallel when given a pure function cmp
.
@Experimental @Parallel
Optionally finds k => v
where v
is the largest value.
Returns None
if m
is empty.
@Experimental @ParallelWhenPure
def maximumValueBy(cmp: v -> (v -> Comparison \ ef), m: DelayMap[k, v]): Option[(k, v)] \ ef
SourceOptionally finds k => v
where k
is the largest value according to the given comparator cmp
.
Returns None
if m
is empty.
Purity reflective: Runs in parallel when given a pure function cmp
.
@Experimental
Returns true
if and only if m
contains the key k
.
@Experimental
def minimumKey(m: DelayMap[k, v]): Option[(k, v)]
SourceOptionally finds k => v
where k
is the smallest key according to the Order
instance of k
.
Returns None
if m
is empty.
@Experimental @ParallelWhenPure
def minimumKeyBy(cmp: k -> (k -> Comparison \ ef), m: DelayMap[k, v]): Option[(k, v)] \ ef
SourceOptionally finds k => v
where k
is the smallest key according to the given comparator cmp
.
Returns None
if m
is empty.
Purity reflective: Runs in parallel when given a pure function cmp
.
@Experimental @Parallel
Optionally finds k => v
where v
is the smallest value.
Returns None
if m
is empty.
@Experimental @ParallelWhenPure
def minimumValueBy(cmp: v -> (v -> Comparison \ ef), m: DelayMap[k, v]): Option[(k, v)] \ ef
SourceOptionally finds k => v
where k
is the smallest value according to the given comparator cmp
.
Returns None
if m
is empty.
Purity reflective: Runs in parallel when given a pure function cmp
.
@Experimental
def nonEmpty(m: DelayMap[k, v]): Bool
SourceReturns true
if and only if m
is a non-empty map.
@Experimental
def reduceLeft(f: v -> (v -> v \ ef), m: DelayMap[k, v]): Option[v] \ ef
SourceApplies f
to all values in m
going from left to right until a single value v
is obtained. Returns Some(v)
.
That is, the result is of the form: Some(f(...f(f(v1, v2), v3)..., vn))
Returns None
if m
is the empty map.
@Experimental
def reduceLeftWithKey(f: k -> (v -> (k -> (v -> (k, v) \ ef))), m: DelayMap[k, v]): Option[(k, v)] \ ef
SourceApplies f
to all mappings in m
going from left to right until a single mapping (k, v)
is obtained. Returns Some((k, v))
.
That is, the result is of the form: Some(f(...f(f(k1, v1, k2, v2), k3, v3)..., kn, vn))
Returns None
if m
is the empty map.
@Experimental
def reduceRight(f: v -> (v -> v \ ef), m: DelayMap[k, v]): Option[v] \ ef
SourceApplies f
to all values in m
going from right to left until a single value v
is obtained. Returns Some(v)
.
That is, the result is of the form: Some(f(v1, ...f(vn-2, f(vn-1, vn))...))
Returns None
if m
is the empty DelayMap.
@Experimental
def reduceRightWithKey(f: k -> (v -> (k -> (v -> (k, v) \ ef))), m: DelayMap[k, v]): Option[(k, v)] \ ef
SourceApplies f
to all mappings in m
going from right to left until a single mapping (k, v)
is obtained. Returns Some((k, v))
.
That is, the result is of the form: Some(f(k1, v1, ...f(kn-2, vn-2, f(kn-1, vn-1, kn, vn))...))
Returns None
if m
is the empty DelayMap.
@Experimental
Removes the mapping k
from the map m
.
@Experimental
Returns the singleton map where key k
is mapped to value v
.
@Experimental @Parallel
def sumKeys(m: DelayMap[Int32, v]): Int32
SourceReturns the sum of all values in m
.
@Experimental @Parallel
def sumValues(m: DelayMap[k, Int32]): Int32
SourceReturns the sum of all values in m
.
@Experimental @ParallelWhenPure
def sumWith(f: k -> (v -> Int32 \ ef), m: DelayMap[k, v]): Int32 \ ef
SourceReturns the sum of all key-value pairs k => v
in m
according to the function f
.
Purity reflective: Runs in parallel when given a pure function f
.
@Experimental
def toDelayList(m: DelayMap[k, v]): DelayList[(k, v)]
SourceReturns the map m
as a DelayList
of key-value pairs.
@Experimental
def toList(m: DelayMap[k, v]): List[(k, v)]
SourceReturns the map m
as a list of key-value pairs.
@Experimental @Parallel
def toMap(m: DelayMap[k, v]): Map[k, v]
SourceReturns m
as a Map, i.e. every value is forced.
@Experimental
def toMutDeque(rc: Region[r], m: DelayMap[k, v]): MutDeque[(k, v), r] \ r
SourceReturns the map m
as a MutDeque of key-value pairs.
@Experimental @Parallel
def toMutMap(rc: Region[r], m: DelayMap[k, v]): MutMap[k, v, r] \ r
SourceReturns m
as a mutable map.
@Experimental
Returns the map m
as a set of key-value pairs.
@Experimental
Returns a string representation of the given DelayMap
m
.
@Experimental @Lazy
Returns the left-biased union of m1
and m2
.
That is, key collisions are resolved by taking the mapping from m1
.
@Experimental @LazyWhenPure
def unionWith(f: v -> (v -> v \ ef), m1: DelayMap[k, v], m2: DelayMap[k, v]): DelayMap[k, v] \ ef with Order[k]
SourceReturns the union of m1
and m2
where key collisions are resolved with the merge function f
.
Purity reflective: Applies f
lazily if f
is pure.
@Experimental @LazyWhenPure
def unionWithKey(f: k -> (v -> (v -> v \ ef)), m1: DelayMap[k, v], m2: DelayMap[k, v]): DelayMap[k, v] \ ef with Order[k]
SourceReturns the union of m1
and m2
where key collisions are resolved with the merge function f
, taking both the key and values.
Purity reflective: Applies f
lazily if f
is pure.
@Experimental @LazyWhenPure
def update(f: v -> Option[v] \ ef, k: k, m: DelayMap[k, v]): DelayMap[k, v] \ ef with Order[k]
SourceUpdates m
with k => v1
if k => v
is in m
and f(v) = Some(v1)
. Otherwise, returns m
.
Purity reflective: Applies f
lazily if f
is pure.