MutDeque
Definitions
def empty(rc: Region[r]): MutDeque[a, r] \ r
SourceReturns an empty MutDeque.
def foldLeft(f: b -> (a -> b \ ef), s: b, d: MutDeque[a, r]): b \ ef + r
SourceApplies f
to a start value s
and all elements in d
going from left to right.
That is, the result is of the form: f(...f(f(s, x1), x2)..., xn)
.
Returns the result of mapping each element and combining the results.
def foldRight(f: a -> (b -> b \ ef), s: b, d: MutDeque[a, r]): b \ ef + r
SourceApplies f
to a start value s
and all elements in d
going from right to left.
That is, the result is of the form: f(x1, ...f(xn-1, f(xn, s))...)
.
def foldRightWithCont(f: a -> ((Unit -> b \ ef + r) -> b \ ef + r), s: b, d: MutDeque[a, r]): b \ ef + r
SourceApplies f
to a start value z
and all elements in d
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 forEach(f: a -> Unit \ ef, d: MutDeque[a, r]): Unit \ ef + r
SourceApply the effectful function f
to all the elements in the MutDeque d
.
def forEachWithIndex(f: Int32 -> (a -> Unit \ ef), d: MutDeque[a, r]): Unit \ ef + r
SourceApply the effectful function f
to all the elements in the MutDeque d
along with that element's index.
def isEmpty(d: MutDeque[a, r]): Bool \ r
SourceReturns true
if d
is empty.
def iterator(rc: Region[r1], d: MutDeque[a, r2]): Iterator[a, r1 + r2, r1] \ r1 + r2
SourceReturns an iterator over d
.
Modifying d
while using an iterator has undefined behavior and is dangerous.
Returns the concatenation of the string representation
of each element in d
with sep
inserted between each element.
def joinWith(f: a -> String \ ef, sep: String, d: MutDeque[a, r]): String \ ef + r
SourceReturns the concatenation of the string representation
of each element in d
according to f
with sep
inserted between each element.
def nonEmpty(d: MutDeque[a, r]): Bool \ r
SourceReturns true
if d
is non-empty.
def peekBack(d: MutDeque[a, r]): Option[a] \ r
SourceOptionally returns the back element. Does not remove it.
def peekFront(d: MutDeque[a, r]): Option[a] \ r
SourceOptionally returns the front element. Does not remove it.
def popBack(d: MutDeque[a, r]): Option[a] \ r
SourceReturns Some(x)
where x
is the element at the back. Returns None
if d
is empty.
def popFront(d: MutDeque[a, r]): Option[a] \ r
SourceReturns Some(x)
where x
is the element at the front. Returns None
if d
is empty.
def pushBack(x: a, d: MutDeque[a, r]): Unit \ r
SourcePushes x
to the back of d
.
def pushFront(x: a, d: MutDeque[a, r]): Unit \ r
SourcePushes x
to the front of d
.
Returns true
if MutDeque
s a
and b
have the same elements in the same order, i.e. are structurally equal.
def shuffle(rc1: Region[r1], d: MutDeque[a, r2]): MutDeque[a, r1] \ r2 + r1 + NonDet
SourceShuffles a copy of d
using the Fisher–Yates shuffle.
def size(d: MutDeque[a, r]): Int32 \ r
SourceReturns the number of elements in d
.
def sum(d: MutDeque[Int32, r]): Int32 \ r
SourceReturns the sum of all elements in the deque d
.
def sumWith(f: a -> Int32 \ ef, d: MutDeque[a, r]): Int32 \ ef + r
SourceReturns the sum of all elements in the deque d
according to the function f
.
def toArray(rc1: Region[r1], d: MutDeque[a, r2]): Array[a, r1] \ r2 + r1
SourceReturns d
as an array.
def toList(d: MutDeque[a, r]): List[a] \ r
SourceReturns d
as a List
.
Returns a string representation of the given MutDeque d
.
def toVector(d: MutDeque[a, r]): Vector[a] \ r
SourceReturns d
as a vector.