DelayMap
Definitions
def
adjust
[vefk]
(
f :
v -> v \ ef
k :
k
m :
DelayMap[k, v]
)
: DelayMap[k, v]
\ ef
with
Order[k]
Updates m with k => f(v) if k => v is in m. Otherwise, returns m.
Purity reflective: Applies f lazily if f is pure.
def
adjustWithKey
[kvef]
(
f :
k -> (v -> v \ ef)
k :
k
m :
DelayMap[k, v]
)
: DelayMap[k, v]
\ ef
with
Order[k]
Updates m with k => f(k, v) if k => v is in m. Otherwise, returns m.
Purity reflective: Applies f lazily if f is pure.
def
count
[kvef]
(
f :
k -> (v -> Bool \ ef)
m :
DelayMap[k, v]
)
: Int32
\ ef
Returns the number of mappings k => v in m that satisfy the predicate f.
Purity reflective: Runs in parallel when given a pure function f.
def
filter
[vefk]
(
f :
v -> Bool \ ef
m :
DelayMap[k, v]
)
: DelayMap[k, v]
\ ef
with
Order[k]
Returns a map of all mappings k => v in m where v satisfies the predicate f.
def
filterWithKey
[kvef]
(
f :
k -> (v -> Bool \ ef)
m :
DelayMap[k, v]
)
: DelayMap[k, v]
\ ef
with
Order[k]
Returns a map of all mappings k => v in m where (k, v) satisfies the predicate f.
def
foldLeft
[bvefk]
(
f :
b -> (v -> b \ ef)
s :
b
m :
DelayMap[k, v]
)
: b
\ ef
Applies 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).
def
foldLeftWithKey
[bkvef]
(
f :
b -> (k -> (v -> b \ ef))
s :
b
m :
DelayMap[k, v]
)
: b
\ ef
Applies 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).
def
foldRight
[vbefk]
(
f :
v -> (b -> b \ ef)
s :
b
m :
DelayMap[k, v]
)
: b
\ ef
Applies 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))).
def
foldRightWithCont
[vefbk]
(
f :
v -> ((Unit -> b \ ef) -> b \ ef)
z :
b
m :
DelayMap[k, v]
)
: b
\ ef
Applies 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.
def
foldRightWithKey
[kvbef]
(
f :
k -> (v -> (b -> b \ ef))
s :
b
m :
DelayMap[k, v]
)
: b
\ ef
Applies 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))).
def
foldRightWithKeyCont
[kvefb]
(
f :
k -> (v -> ((Unit -> b \ ef) -> b \ ef))
s :
b
m :
DelayMap[k, v]
)
: b
\ ef
Applies 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.
def
forEach
[kvef]
(
f :
k -> (v -> Unit \ ef)
m :
DelayMap[k, v]
)
: Unit
\ ef
Applies f to every (key, value) of m.
def
forEachWithIndex
[kvef]
(
f :
Int32 -> (k -> (v -> Unit \ ef))
m :
DelayMap[k, v]
)
: Unit
\ ef
Applies f to tuple (index, key, value) formed of the keys and values of
DelayMap m and the index of the traversal.
def
forceAll
[kv]
(
m :
DelayMap[k, v]
)
: Unit
\ Pure
Forces all values in m.
def
get
[kv]
(
k :
k
m :
DelayMap[k, v]
)
: Option[v]
\ Pure
with
Order[k]
Returns Some(v) if k => v is in m.
Otherwise returns None.
def
getWithDefault
[kv]
(
k :
k
d :
v
m :
DelayMap[k, v]
)
: v
\ Pure
with
Order[k]
Returns v if k => v is in m.
Otherwise, returns d.
def
insert
[kv]
(
k :
k
v :
v
m :
DelayMap[k, v]
)
: DelayMap[k, v]
\ Pure
with
Order[k]
Returns m with k => v.
def
insertWith
[vefk]
(
f :
v -> (v -> v \ ef)
k :
k
v :
v
m :
DelayMap[k, v]
)
: DelayMap[k, v]
\ ef
with
Order[k]
Updates m with k => f(v, v1) if k => v1 is in m.
Otherwise, updates m with k => v.
def
insertWithKey
[kvef]
(
f :
k -> (v -> (v -> v \ ef))
k :
k
v :
v
m :
DelayMap[k, v]
)
: DelayMap[k, v]
\ ef
with
Order[k]
Updates m with k => f(k, v, v1) if k => v1 is in m.
Otherwise, updates m with k => v.
def
isEmpty
[kv]
(
m :
DelayMap[k, v]
)
: Bool
\ Pure
Returns true if and only if m is the empty map, i.e. Map(Nil).
def
iterator
[rab]
(
rc :
Region[r]
m :
DelayMap[a, b]
)
: Iterator[(a, b), r, r]
\ r
Returns an iterator over all key-value pairs in m.
def
joinKeys
[kv]
(
sep :
String
m :
DelayMap[k, v]
)
: String
\ Pure
with
ToString[k]
Returns the concatenation of the string representation of each key k
in m with sep inserted between each element.
def
joinValues
[kv]
(
sep :
String
m :
DelayMap[k, v]
)
: String
\ Pure
with
ToString[v]
Returns the concatenation of the string representation of each value v
in m with sep inserted between each element.
def
joinWith
[kvef]
(
f :
k -> (v -> String \ ef)
sep :
String
m :
DelayMap[k, v]
)
: String
\ ef
Returns the concatenation of the string representation of each key-value pair
k => v in m according to f with sep inserted between each element.
def
keysOf
[kv]
(
m :
DelayMap[k, v]
)
: Set[k]
\ Pure
with
Order[k]
Returns the keys of m.
def
map
[v1efv2k]
(
f :
v1 -> v2 \ ef
m :
DelayMap[k, v1]
)
: DelayMap[k, v2]
\ ef
Returns 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
flazily iffis pure.
def
mapWithKey
[kv1efv2]
(
f :
k -> (v1 -> v2 \ ef)
m :
DelayMap[k, v1]
)
: DelayMap[k, v2]
\ ef
Returns 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
flazily iffis pure.
def
maximumKey
[kv]
(
m :
DelayMap[k, v]
)
: Option[(k, v)]
\ Pure
Optionally finds k => v where k is the largest key according to the Order instance of k.
Returns None if m is empty.
def
maximumKeyBy
[kefv]
(
cmp :
k -> (k -> Comparison \ ef)
m :
DelayMap[k, v]
)
: Option[(k, v)]
\ ef
Optionally 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.
def
maximumValue
[kv]
(
m :
DelayMap[k, v]
)
: Option[(k, v)]
\ Pure
with
Order[v]
Optionally finds k => v where v is the largest value.
Returns None if m is empty.
def
maximumValueBy
[vefk]
(
cmp :
v -> (v -> Comparison \ ef)
m :
DelayMap[k, v]
)
: Option[(k, v)]
\ ef
Optionally 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.
def
memberOf
[kv]
(
k :
k
m :
DelayMap[k, v]
)
: Bool
\ Pure
with
Order[k]
Returns true if and only if m contains the key k.
def
minimumKey
[kv]
(
m :
DelayMap[k, v]
)
: Option[(k, v)]
\ Pure
Optionally finds k => v where k is the smallest key according to the Order instance of k.
Returns None if m is empty.
def
minimumKeyBy
[kefv]
(
cmp :
k -> (k -> Comparison \ ef)
m :
DelayMap[k, v]
)
: Option[(k, v)]
\ ef
Optionally 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.
def
minimumValue
[kv]
(
m :
DelayMap[k, v]
)
: Option[(k, v)]
\ Pure
with
Order[v]
Optionally finds k => v where v is the smallest value.
Returns None if m is empty.
def
minimumValueBy
[vefk]
(
cmp :
v -> (v -> Comparison \ ef)
m :
DelayMap[k, v]
)
: Option[(k, v)]
\ ef
Optionally 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.
def
reduceLeft
[vefk]
(
f :
v -> (v -> v \ ef)
m :
DelayMap[k, v]
)
: Option[v]
\ ef
Applies 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.
def
reduceLeftWithKey
[kvef]
(
f :
k -> (v -> (k -> (v -> (k, v) \ ef)))
m :
DelayMap[k, v]
)
: Option[(k, v)]
\ ef
Applies 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.
def
reduceRight
[vefk]
(
f :
v -> (v -> v \ ef)
m :
DelayMap[k, v]
)
: Option[v]
\ ef
Applies 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.
def
reduceRightWithKey
[kvef]
(
f :
k -> (v -> (k -> (v -> (k, v) \ ef)))
m :
DelayMap[k, v]
)
: Option[(k, v)]
\ ef
Applies 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.
def
remove
[kv]
(
k :
k
m :
DelayMap[k, v]
)
: DelayMap[k, v]
\ Pure
with
Order[k]
Removes the mapping k from the map m.
def
singleton
[kv]
(
k :
k
v :
v
)
: DelayMap[k, v]
\ Pure
with
Order[k]
Returns the singleton map where key k is mapped to value v.
def
size
[kv]
(
m :
DelayMap[k, v]
)
: Int32
\ Pure
Returns the number of keys in m.
def
sumKeys
[v]
(
m :
DelayMap[Int32, v]
)
: Int32
\ Pure
Returns the sum of all values in m.
def
sumValues
[k]
(
m :
DelayMap[k, Int32]
)
: Int32
\ Pure
Returns the sum of all values in m.
def
sumWith
[kvef]
(
f :
k -> (v -> Int32 \ ef)
m :
DelayMap[k, v]
)
: Int32
\ ef
Returns 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.
def
toDelayList
[kv]
(
m :
DelayMap[k, v]
)
: DelayList[(k, v)]
\ Pure
Returns the map m as a DelayList of key-value pairs.
def
toList
[kv]
(
m :
DelayMap[k, v]
)
: List[(k, v)]
\ Pure
Returns the map m as a list of key-value pairs.
def
toMap
[kv]
(
m :
DelayMap[k, v]
)
: Map[k, v]
\ Pure
Returns m as a Map, i.e. every value is forced.
def
toMutDeque
[rkv]
(
rc :
Region[r]
m :
DelayMap[k, v]
)
: MutDeque[(k, v), r]
\ r
Returns the map m as a MutDeque of key-value pairs.
def
toMutMap
[rkv]
(
rc :
Region[r]
m :
DelayMap[k, v]
)
: MutMap[k, v, r]
\ r
Returns m as a mutable map.
def
toSet
[kv]
(
m :
DelayMap[k, v]
)
: Set[(k, v)]
\ Pure
with
Order[k]
Order[v]
Returns the map m as a set of key-value pairs.
def
toString
[kv]
(
m :
DelayMap[k, v]
)
: String
\ Pure
with
ToString[k]
ToString[v]
Returns a string representation of the given DelayMap m.
def
union
[kv]
(
m1 :
DelayMap[k, v]
m2 :
DelayMap[k, v]
)
: DelayMap[k, v]
\ Pure
with
Order[k]
Returns the left-biased union of m1 and m2.
That is, key collisions are resolved by taking the mapping from m1.
def
unionWith
[vefk]
(
f :
v -> (v -> v \ ef)
m1 :
DelayMap[k, v]
m2 :
DelayMap[k, v]
)
: DelayMap[k, v]
\ ef
with
Order[k]
Returns 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.
def
unionWithKey
[kvef]
(
f :
k -> (v -> (v -> v \ ef))
m1 :
DelayMap[k, v]
m2 :
DelayMap[k, v]
)
: DelayMap[k, v]
\ ef
with
Order[k]
Returns 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.
def
update
[vefk]
(
f :
v -> Option[v] \ ef
k :
k
m :
DelayMap[k, v]
)
: DelayMap[k, v]
\ ef
with
Order[k]
Updates 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.
def
updateWithKey
[kvef]
(
f :
k -> (v -> Option[v] \ ef)
k :
k
m :
DelayMap[k, v]
)
: DelayMap[k, v]
\ ef
with
Order[k]
Updates m with k => v1 if k => v is in m and f(k, v) = Some(v1). Otherwise, returns m.
Purity reflective: Applies f lazily if f is pure.
def
valuesOf
[kv]
(
m :
DelayMap[k, v]
)
: List[v]
\ Pure
Returns the values of m.