MutSet
Definitions
def
add!
[ar]
(
x :
a
s :
MutSet[a, r]
)
: Unit
\ r
with
Order[a]
Adds the element x
to the mutable set s
.
def
addAll!
[mar]
(
m :
m[a]
s :
MutSet[a, r]
)
: Unit
\ r
with
Order[a]
Foldable[m]
Adds all elements in the collection m
to the mutable set s
.
def
clear!
[ar]
(
s :
MutSet[a, r]
)
: Unit
\ r
Removes all elements from the mutable set s
.
def
copy
[r1ar]
(
rc1 :
Region[r1]
s :
MutSet[a, r]
)
: MutSet[a, r1]
\ r + r1
Returns a shallow copy of the mutable set s
.
def
count
[aefr]
(
f :
a -> Bool \ ef
s :
MutSet[a, r]
)
: Int32
\ ef + r
Returns the number of elements in the mutable set s
that satisfy the predicate function f
.
Purity reflective: Runs in parallel when given a pure function f
.
def
enumerator
[r1ar2]
(
rc :
Region[r1]
s :
MutSet[a, r2]
)
: Iterator[(Int32, a), r1 + r2, r1]
\ r1 + r2
Returns an enumerator over s
.
def
exists
[aefr]
(
f :
a -> Bool \ ef
s :
MutSet[a, r]
)
: Bool
\ ef + r
Returns true
if and only if at least one element in the mutable set s
satisfies the predicate function f
.
Returns false
if s
is the empty set.
def
find
[ar]
(
f :
a -> Bool
s :
MutSet[a, r]
)
: Option[a]
\ r
Alias for findLeft
.
The function f
must be pure.
def
findLeft
[ar]
(
f :
a -> Bool
s :
MutSet[a, r]
)
: Option[a]
\ r
Optionally returns the first element of the mutable set s
that satisfies the predicate function f
when searching from left to right.
The function f
must be pure.
def
findRight
[ar]
(
f :
a -> Bool
s :
MutSet[a, r]
)
: Option[a]
\ r
Optionally returns the first element of the mutable set s
that satisfies the predicate function f
when searching from right to left.
The function f
must be pure.
def
foldLeft
[baefr]
(
f :
b -> (a -> b \ ef)
i :
b
s :
MutSet[a, r]
)
: b
\ ef + r
Applies f
to a start value i
and all elements in the mutable set s
going from left to right.
That is, the result is of the form: f(...f(f(i, x1), x2)..., xn)
.
def
foldMap
[aefbr]
(
f :
a -> b \ ef
s :
MutSet[a, r]
)
: b
\ ef + r
with
Monoid[b]
Returns the result of mapping each element and combining the results.
def
foldRight
[abefr]
(
f :
a -> (b -> b \ ef)
z :
b
s :
MutSet[a, r]
)
: b
\ ef + r
Applies f
to a start value z
and all elements in the mutable set s
going from right to left.
That is, the result is of the form: f(x1, ...f(xn-1, f(xn, z))...)
.
def
foldRightWithCont
[aefbr]
(
f :
a -> ((Unit -> b \ ef) -> b \ ef)
z :
b
s :
MutSet[a, r]
)
: b
\ ef + r
Applies f
to a start value z
and all elements in the mutable set s
going from right to left.
That is, the result is of the form: f(x1, ...f(xn-1, f(xn, z))...)
.
A foldRightWithCont
allows early termination by not calling the continuation.
def
forAll
[aefr]
(
f :
a -> Bool \ ef
s :
MutSet[a, r]
)
: Bool
\ ef + r
Returns true
if and only if all elements in the mutable set s
satisfy the predicate function f
.
Returns true
if s
is the empty set.
def
forEach
[aefr]
(
f :
a -> Unit \ ef
s :
MutSet[a, r]
)
: Unit
\ ef + r
Applies f
to every element of the mutable set s
.
def
forEachWithIndex
[aefr]
(
f :
Int32 -> (a -> Unit \ ef)
s :
MutSet[a, r]
)
: Unit
\ ef + r
Applies f
to every element of the mutable set s
along with that element's index.
def
isEmpty
[ar]
(
s :
MutSet[a, r]
)
: Bool
\ r
Returns true if and only if s
is the empty set.
def
isProperSubsetOf
[ar1r2]
(
s1 :
MutSet[a, r1]
s2 :
MutSet[a, r2]
)
: Bool
\ r1 + r2
with
Order[a]
Returns true if and only if every element in the mutable set s1
appears in the mutable set s2
and s1 != s2
.
def
isSubsetOf
[ar1r2]
(
s1 :
MutSet[a, r1]
s2 :
MutSet[a, r2]
)
: Bool
\ r1 + r2
with
Order[a]
Returns true if and only if every element in the mutable set s1
appears in the mutable set s2
.
def
iterator
[r1ar2]
(
rc :
Region[r1]
s :
MutSet[a, r2]
)
: Iterator[a, r1 + r2, r1]
\ r1 + r2
Returns an iterator over s
.
def
join
[ar]
(
sep :
String
s :
MutSet[a, r]
)
: String
\ r
with
ToString[a]
Returns the concatenation of the string representation
of each element in s
with sep
inserted between each element.
def
joinWith
[aefr]
(
f :
a -> String \ ef
sep :
String
s :
MutSet[a, r]
)
: String
\ ef + r
Returns the concatenation of the string representation
of each element in s
according to f
with sep
inserted between each element.
def
maximum
[ar]
(
s :
MutSet[a, r]
)
: Option[a]
\ r
Optionally finds the largest element of s
according to the Order
on a
.
Returns None
if s
is empty.
def
maximumBy
[aefr]
(
cmp :
a -> (a -> Comparison \ ef)
s :
MutSet[a, r]
)
: Option[a]
\ ef + r
Optionally finds the largest element of s
according to the given comparator cmp
.
Returns None
if s
is empty.
Purity reflective: Runs in parallel when given a pure function f
.
def
memberOf
[ar]
(
x :
a
s :
MutSet[a, r]
)
: Bool
\ r
with
Order[a]
Returns true if and only if x
is a member of the mutable set s
.
def
minimum
[ar]
(
s :
MutSet[a, r]
)
: Option[a]
\ r
Optionally finds the smallest element of s
according to the Order
on a
.
Returns None
if s
is empty.
def
minimumBy
[aefr]
(
cmp :
a -> (a -> Comparison \ ef)
s :
MutSet[a, r]
)
: Option[a]
\ ef + r
Optionally finds the smallest element of s
according to the given comparator cmp
.
Returns None
if s
is empty.
Purity reflective: Runs in parallel when given a pure function f
.
def
new
[ra]
(
rc :
Region[r]
)
: MutSet[a, r]
\ r
Returns a fresh empty set.
def
partition
[r1r2ar]
(
rc1 :
Region[r1]
rc2 :
Region[r2]
f :
a -> Bool
s :
MutSet[a, r]
)
: (MutSet[a, r1], MutSet[a, r2])
\ r + r1 + r2
with
Order[a]
s1
contains all elements of the mutable set s
that satisfy the predicate function f
.
s2
contains all elements of the mutable set s
that do not satisfy the predicate function f
.
The function f
must be pure.
def
reduceLeft
[aefr]
(
f :
a -> (a -> a \ ef)
s :
MutSet[a, r]
)
: Option[a]
\ ef + r
Applies f
to all elements in the mutable set s
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(x1, x2), x3)..., xn))
Returns None
if s
is the empty set.
def
reduceRight
[aefr]
(
f :
a -> (a -> a \ ef)
s :
MutSet[a, r]
)
: Option[a]
\ ef + r
Applies f
to all elements in the mutable set s
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(x1, ...f(xn-2, f(xn-1, xn))...))
Returns None
if s
is the empty set.
def
refine!
[ar]
(
f :
a -> Bool
s :
MutSet[a, r]
)
: Unit
\ r
with
Order[a]
Removes all elements from the mutable set s
that do not satisfy the predicate function f
.
The function f
must be pure.
def
remove!
[ar]
(
x :
a
s :
MutSet[a, r]
)
: Unit
\ r
with
Order[a]
Removes the element x
from the mutable set s
.
def
removeAll!
[mar]
(
m :
m[a]
s :
MutSet[a, r]
)
: Unit
\ r
with
Order[a]
Foldable[m]
Removes all elements in the collection m
from the mutable set s
.
def
replace!
[ar]
(
from :
{ from = a }
to :
{ to = a }
s :
MutSet[a, r]
)
: Unit
\ r
with
Order[a]
Replaces the element from
with the element to
if from
is in the mutable set s
.
The mutable set s
is unchanged if the element from
is not in it.
def
retainAll!
[mar]
(
m :
m[a]
s :
MutSet[a, r]
)
: Unit
\ r
with
Order[a]
Foldable[m]
Removes all elements from the mutable set s
that are not in collection m
.
def
sameElements
[ar]
(
a :
MutSet[a, r]
b :
MutSet[a, r]
)
: Bool
\ r
with
Order[a]
Returns true
if MutSets a
and b
have the same elements, i.e. are structurally equal.
def
singleton
[ra]
(
rc :
Region[r]
x :
a
)
: MutSet[a, r]
\ r
with
Order[a]
Returns the singleton set containing x
.
def
size
[ar]
(
s :
MutSet[a, r]
)
: Int32
\ r
Returns the size of the mutable set s
.
def
sum
[r]
(
s :
MutSet[Int32, r]
)
: Int32
\ r
Returns the sum of all elements in the mutable set s
.
def
sumWith
[aefr]
(
f :
a -> Int32 \ ef
s :
MutSet[a, r]
)
: Int32
\ ef + r
Returns the sum of all elements in the mutable set s
according to the function f
.
Purity reflective: Runs in parallel when given a pure function f
.
def
toList
[ar]
(
s :
MutSet[a, r]
)
: List[a]
\ r
Returns the mutable set s
as a list.
def
toMap
[abr]
(
s :
MutSet[(a, b), r]
)
: Map[a, b]
\ r
with
Order[a]
Returns the association set s
as a map.
If s
contains multiple mappings with the same key, toMap
does not
make any guarantees about which mapping will be in the resulting map.
def
toMutDeque
[r1ar2]
(
rc1 :
Region[r1]
s :
MutSet[a, r2]
)
: MutDeque[a, r1]
\ r2 + r1
Returns the mutable set s
as a MutDeque.
def
toSet
[ar]
(
s :
MutSet[a, r]
)
: Set[a]
\ r
Returns the mutable set s
as an immutable set.
def
toString
[ar]
(
s :
MutSet[a, r]
)
: String
\ r
with
ToString[a]
Returns a string representation of the given mutable set s
.
def
transform!
[aefr]
(
f :
a -> a \ ef
s :
MutSet[a, r]
)
: Unit
\ ef + r
with
Order[a]
Applies the function f
to every element in the mutable set s
.