FSharpx.Collections


RandomAccessList<'T> Type

RandomAccessList is an ordered linear structure implementing the List signature (head, tail, cons), as well as inspection (lookup) and update (returning a new immutable instance) of any element in the structure by index. Length is O(1). Indexed lookup or update (returning a new immutable instance of RandomAccessList) of any element is O(log32n), which is close enough to O(1) as to make no practical difference: a RandomAccessList containing 4 billion items can lookup or update any item in at most 7 steps. Ordering is by insertion history. While PersistentVector<'T> is appending to the end this version prepends elements to the list.

Instance members

Instance member Description

this.Cons(arg1)

Full Usage: this.Cons(arg1)

Parameters:
    arg0 : 'T

Returns: RandomAccessList<'T>

O(1). Returns a new random access list with the element added at the start.

arg0 : 'T
Returns: RandomAccessList<'T>

this.Head

Full Usage: this.Head

Returns: 'T

O(1). Returns the first element in the random access list. If the random access list is empty it throws an exception.

Returns: 'T

this.IsEmpty

Full Usage: this.IsEmpty

Returns: bool

O(1). Returns true if the random access list 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 random access list element at the index.

arg0 : int
Returns: 'T

this.Length

Full Usage: this.Length

Returns: int

O(1). Returns the number of items in the random access list.

Returns: int

this.Rev()

Full Usage: this.Rev()

Returns: RandomAccessList<'T>

O(n). Returns random access list reversed.

Returns: RandomAccessList<'T>

this.Tail

Full Usage: this.Tail

Returns: RandomAccessList<'T>

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

Returns: RandomAccessList<'T>

this.TryHead

Full Usage: this.TryHead

Returns: 'T option

O(1). Returns option first element in the random access list.

Returns: 'T option

this.TryTail

Full Usage: this.TryTail

Returns: RandomAccessList<'T> option

O(1) for all practical purposes; really O(log32n). Returns option random access list without the first item.

Returns: RandomAccessList<'T> option

this.TryUncons

Full Usage: this.TryUncons

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

O(1) for all practical purposes; really O(log32n). Returns option tuple first element and random access list without first item

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

this.TryUpdate(arg1, arg2)

Full Usage: this.TryUpdate(arg1, arg2)

Parameters:
    arg0 : int
    arg1 : 'T

Returns: RandomAccessList<'T> option

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

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

this.Uncons

Full Usage: this.Uncons

Returns: 'T * RandomAccessList<'T>

O(1) for all practical purposes; really O(log32n). Returns tuple first element and random access list without first item

Returns: 'T * RandomAccessList<'T>

this.Update(arg1, arg2)

Full Usage: this.Update(arg1, arg2)

Parameters:
    arg0 : int
    arg1 : 'T

Returns: RandomAccessList<'T>

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

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