FSharpx.Collections


PersistentVector<'T> Type

PersistentVector is an ordered linear structure implementing the inverse of the List signature, (last, initial, conj) in place of (head, tail, cons). Length is O(1). Indexed lookup or update (returning a new immutable instance of Vector) of any element is O(log32n), which is close enough to O(1) as to make no practical difference: a PersistentVector containing 4 billion items can lookup or update any item in at most 7 steps. Ordering is by insertion history. The original idea can be found in [Clojure](http://clojure.org/data_structures).

Instance members

Instance member Description

this.Conj(arg1)

Full Usage: this.Conj(arg1)

Parameters:
    arg0 : 'T

Returns: PersistentVector<'T>

O(1). Returns a new vector with the element added at the end.

arg0 : 'T
Returns: PersistentVector<'T>

this.Initial

Full Usage: this.Initial

Returns: PersistentVector<'T>

O(1) for all practical purposes; really O(log32n). Returns a new vector without the last item. If the collection is empty it throws an exception.

Returns: PersistentVector<'T>

this.IsEmpty

Full Usage: this.IsEmpty

Returns: bool

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

Returns: bool

this.[arg1]

Full Usage: this.[arg1]

Parameters:
    arg0 : int

Returns: 'T

O(1) for all practical purposes; really O(log32n). Returns vector element at the index.

arg0 : int
Returns: 'T

this.Last

Full Usage: this.Last

Returns: 'T

O(1). Returns the last element in the vector. If the vector is empty it throws an exception.

Returns: 'T

this.Length

Full Usage: this.Length

Returns: int

O(1). Returns the number of items in the vector.

Returns: int

this.Rev()

Full Usage: this.Rev()

Returns: PersistentVector<'T>

O(n). Returns random access list reversed.

Returns: PersistentVector<'T>

this.TryInitial

Full Usage: this.TryInitial

Returns: PersistentVector<'T> option

O(1) for all practical purposes; really O(log32n). Returns option vector without the last item.

Returns: PersistentVector<'T> option

this.TryLast

Full Usage: this.TryLast

Returns: 'T option

O(1). Returns option last element in the vector.

Returns: 'T option

this.TryUnconj

Full Usage: this.TryUnconj

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

O(1) for all practical purposes; really O(log32n). Returns option tuple last element and vector without last item

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

this.TryUpdate(arg1, arg2)

Full Usage: this.TryUpdate(arg1, arg2)

Parameters:
    arg0 : int
    arg1 : 'T

Returns: PersistentVector<'T> option

O(1) for all practical purposes; really O(log32n). Returns option vector that contains the given value at the index.

arg0 : int
arg1 : 'T
Returns: PersistentVector<'T> option

this.Unconj

Full Usage: this.Unconj

Returns: PersistentVector<'T> * 'T

O(1) for all practical purposes; really O(log32n). Returns tuple last element and vector without last item

Returns: PersistentVector<'T> * 'T

this.Update(arg1, arg2)

Full Usage: this.Update(arg1, arg2)

Parameters:
    arg0 : int
    arg1 : 'T

Returns: PersistentVector<'T>

O(1) for all practical purposes; really O(log32n). Returns a new vector that contains the given value at the index.

arg0 : int
arg1 : 'T
Returns: PersistentVector<'T>

Static members

Static member Description

PersistentVector.Empty()

Full Usage: PersistentVector.Empty()

Returns: PersistentVector<'T>

O(1). Returns a new PersistentVector with no elements.

Returns: PersistentVector<'T>