Yaaf.FSharp.Helper


Queue<'T>

Defined in Yaaf.FSharp.Helper.dll.

Queue is an ordered linear data structure where elements are added at the end (right) and inspected and removed at the beginning (left). Ordering is by insertion history. The qualities of the Queue structure make elements first in, first out (fifo). "head" inspects the first or left-most element in the structure, while "conj" inserts an element at the end, or right of the structure. Purely functional (immutable) Queue based on Okasaki's batched queue.

Instance members

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

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

Head
Signature: 'T

O(1). Returns the first element. (Peek)

IsEmpty
Signature: bool

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

Length
Signature: int

O(1). Returns the count of elememts.

Rev()
Signature: unit -> Queue<'T>

O(n). Returns queue reversed.

Tail
Signature: Queue<'T>

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

TryHead
Signature: 'T option

O(1). Returns option first element

TryTail
Signature: Queue<'T> option

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

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

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

Uncons
Signature: 'T * Queue<'T>

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

Fork me on GitHub