FSharpx.Collections


Queue<'T> Type

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 member Description

this.Conj(arg1)

Full Usage: this.Conj(arg1)

Parameters:
    arg0 : 'T

Returns: Queue<'T>

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

arg0 : 'T
Returns: Queue<'T>

this.Head

Full Usage: this.Head

Returns: 'T

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

Returns: 'T

this.IsEmpty

Full Usage: this.IsEmpty

Returns: bool

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

Returns: bool

this.Length

Full Usage: this.Length

Returns: int

O(1). Returns the count of elememts.

Returns: int

this.Rev()

Full Usage: this.Rev()

Returns: Queue<'T>

O(n). Returns queue reversed.

Returns: Queue<'T>

this.Tail

Full Usage: this.Tail

Returns: Queue<'T>

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

Returns: Queue<'T>

this.TryHead

Full Usage: this.TryHead

Returns: 'T option

O(1). Returns option first element

Returns: 'T option

this.TryTail

Full Usage: this.TryTail

Returns: Queue<'T> option

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

Returns: Queue<'T> option

this.TryUncons

Full Usage: this.TryUncons

Returns: ('T * Queue<'T>) option

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

Returns: ('T * Queue<'T>) option

this.Uncons

Full Usage: this.Uncons

Returns: 'T * Queue<'T>

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

Returns: 'T * Queue<'T>