MutDeque
Type of mutable double-ended queues, and its functions.
struct MutDeque[a: Type, r: Eff]Sourcer: Region[r]mut values: Array[a, r]mut front: Int32mut back: Int32Type of mutable double-ended queues.
Explanation of component types (from left to right): The 1st component is a reference the backing array. The 2nd component is a reference to the front index. The 3rd component is a reference to the back index.
If front == back then the deque is empty. Otherwise, the front index always points to an element (going counter-clockwise) and the back index always points to the first empty index (going clockwise).
Instances
Definitions
Returns an empty mutable deque with the given capacity rounded up to the default capacity.
Applies 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.
Applies 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))...).
Apply the effectful function f to all the elements in the MutDeque d.
Apply the effectful function f to all the elements in the MutDeque d
along with that element's index.
Returns a range of all valid indices of the mutable deque d.
Returns 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.
Returns the concatenation of the string representation
of each element in d according to f with sep inserted between each element.
Optionally returns the back element. Does not remove it.
Optionally returns the front element. Does not remove it.
Returns Some(x) where x is the element at the back. Returns None if d is empty.
Returns Some(x) where x is the element at the front. Returns None if d is empty.
Returns true if MutDeques a and b have the same elements in the same order, i.e. are structurally equal.
Shuffles a copy of d using the Fisher–Yates shuffle.
Returns the sum of all elements in the deque d according to the function f.
Returns d as an array.
Returns a string representation of the given MutDeque d.