Yaaf.FSharp.Helper


Deque<'T>

Defined in Yaaf.FSharp.Helper.dll.

Double-ended queue is an ordered linear linear structure implementing the signature of List (head, tail, cons) as well as the mirror-image Vector signature (last, initial, conj). "head" inspects the first or left-most element in the structure, while "last" inspects the last or right-most element. "rev" (reverse) has time complexity O(1). Ordering is by insertion history.

Instance members

Instance memberDescription
Conj(arg1)
Signature: 'T -> Deque<'T>

O(1). Returns a new deque with the element added to the end.

Cons(arg1)
Signature: 'T -> Deque<'T>

O(1). Returns a new deque with the element added to the beginning.

Head
Signature: 'T

O(1) amortized, O(n), worst case. Returns the first element.

Initial
Signature: Deque<'T>

O(1) amortized, O(n), worst case. Returns a new deque of the elements before the last element.

IsEmpty
Signature: bool

O(1). Returns true if the deque has no elements.

Last
Signature: 'T

O(1) amortized, O(n), worst case. Returns the last element.

Length
Signature: int

O(1). Returns the count of elememts.

Rev
Signature: Deque<'T>

O(1). Returns deque reversed.

Tail
Signature: Deque<'T>

O(1) amortized, O(n), worst case. Returns a new deque of the elements trailing the first element.

TryHead
Signature: 'T option

O(1) amortized, O(n), worst case. Returns option first element.

TryInitial
Signature: Deque<'T> option

O(1) amortized, O(n), worst case. Returns a new deque of the elements before the last element.

TryLast
Signature: 'T option

O(1) amortized, O(n), worst case. Returns option last element.

TryTail
Signature: Deque<'T> option

O(1) amortized, O(n), worst case. Returns option deque of the elements trailing the first element.

TryUnconj
Signature: (Deque<'T> * 'T) option

O(1) amortized, O(n), worst case. Returns option init and the last element.

TryUncons
Signature: ('T * Deque<'T>) option

O(1) amortized, O(n), worst case. Returns option first element and tail.

Unconj
Signature: Deque<'T> * 'T

O(1) amortized, O(n), worst case. Returns init and the last element.

Uncons
Signature: 'T * Deque<'T>

O(1) amortized, O(n), worst case. Returns the first element and tail.

Fork me on GitHub