Header menu logo FSharp.Data.Adaptive

IndexList<'T> Type

A persitent array-like structure that allows lookup/insertion/deletion of entries in O(log N). Note that datastructure uses Index instead of int as index type which allows for these efficient implementations. However the datastructure also has accessors that allow getting/setting/deleting entries via an int-index in O(log N).

Instance members

Instance member Description

this.Add

Full Usage: this.Add

Parameters:
    element : 'T

Returns: IndexList<'T>

Appends the given element to the list.

element : 'T
Returns: IndexList<'T>

this.AsArray

Full Usage: this.AsArray

Returns: 'T[]

Returns all entres from the list.

Returns: 'T[]

this.AsArrayBackward

Full Usage: this.AsArrayBackward

Returns: 'T[]

Returns all entres from the list in back-to-front order.

Returns: 'T[]

this.AsList

Full Usage: this.AsList

Returns: 'T list

Returns all entres from the list.

Returns: 'T list

this.AsListBackward

Full Usage: this.AsListBackward

Returns: 'T list

Returns all entres from the list in back-to-front order.

Returns: 'T list

this.AsSeq

Full Usage: this.AsSeq

Returns: 'T seq

Returns all entres from the list.

Returns: 'T seq

this.AsSeqBackward

Full Usage: this.AsSeqBackward

Returns: 'T seq

Returns all entres from the list in back-to-front order.

Returns: 'T seq

this.Choose

Full Usage: this.Choose

Parameters:
    mapping : Index -> 'T -> 'T2 option

Returns: IndexList<'T2>

Applies the mapping function to all elements of the list and returns a new list containing all Some entries.

mapping : Index -> 'T -> 'T2 option
Returns: IndexList<'T2>

this.ConservativeEquals

Full Usage: this.ConservativeEquals

Parameters:
Returns: bool

Conservatively determines whether the two IndexLists are equal. `O(1)`

other : IndexList<'T>
Returns: bool

this.CopyTo

Full Usage: this.CopyTo

Parameters:
    dst : 'T[]
    dstIndex : int

Copies the list to the given array (starting at index)

dst : 'T[]
dstIndex : int

this.Count

Full Usage: this.Count

Returns: int

The number of entries in the list.

Returns: int

this.Deconstruct

Full Usage: this.Deconstruct

Returns: (Index * 'T) * IndexList<'T>

deconstructs the list. returns its head and tail if successful and fails otherwise.

Returns: (Index * 'T) * IndexList<'T>

this.DeconstructV

Full Usage: this.DeconstructV

Returns: (Index * 'T) * IndexList<'T>

deconstructs the list. returns its head and tail if successful and fails otherwise.

Returns: (Index * 'T) * IndexList<'T>

this.Filter

Full Usage: this.Filter

Parameters:
    predicate : Index -> 'T -> bool

Returns: IndexList<'T>

Filters the list using the given predicate.

predicate : Index -> 'T -> bool
Returns: IndexList<'T>

this.GetEnumerator

Full Usage: this.GetEnumerator

Returns: IndexListEnumerator<'T>
Returns: IndexListEnumerator<'T>

this.GetSlice

Full Usage: this.GetSlice

Parameters:
Returns: IndexList<'T>
min : Index option
max : Index option
Returns: IndexList<'T>

this.GetSlice

Full Usage: this.GetSlice

Parameters:
    min : int option
    max : int option

Returns: IndexList<'T>
min : int option
max : int option
Returns: IndexList<'T>

this.IndexOf

Full Usage: this.IndexOf

Parameters:
Returns: int

Tries to find the position for the given Index or -1 if the Index does not exist. O(log N)

index : Index
Returns: int

this.IndexOf

Full Usage: this.IndexOf

Parameters:
    item : 'T

Returns: int

Tries to find the position for the given entry or -1 if the entry does not exist. O(N)

item : 'T
Returns: int

this.InsertAfter

Full Usage: this.InsertAfter

Parameters:
    index : Index
    value : 'T

Returns: IndexList<'T>

Inserts the element directly after the given index.

index : Index
value : 'T
Returns: IndexList<'T>

this.InsertAt

Full Usage: this.InsertAt

Parameters:
    index : int
    value : 'T

Returns: IndexList<'T>

Inserts the element at the given position or returns the unmodified list if the index is not in [0..count]. Note that InsertAt works with index = count.

index : int
value : 'T
Returns: IndexList<'T>

this.InsertBefore

Full Usage: this.InsertBefore

Parameters:
    index : Index
    value : 'T

Returns: IndexList<'T>

Inserts the element directly before the given index.

index : Index
value : 'T
Returns: IndexList<'T>

this.IsEmpty

Full Usage: this.IsEmpty

Returns: bool

Is the list empty?

Returns: bool

this[i]

Full Usage: this[i]

Parameters:
    i : int

Returns: 'T

Gets the entry at the given index or fails if not existing.

i : int
Returns: 'T

this[i]

Full Usage: this[i]

Parameters:
Returns: 'T

Gets the entry associated to the given index or fails if not existing.

i : Index
Returns: 'T

this.Map

Full Usage: this.Map

Parameters:
    mapping : Index -> 'T -> 'T2

Returns: IndexList<'T2>

Applies the mapping function to all elements of the list and returns a new list containing the results.

mapping : Index -> 'T -> 'T2
Returns: IndexList<'T2>

this.MaxIndex

Full Usage: this.MaxIndex

Returns: Index

The largest Index contained in the list or Index.zero if the list is empty.

Returns: Index

this.MinIndex

Full Usage: this.MinIndex

Returns: Index

The smallest Index contained in the list or Index.zero if the list is empty.

Returns: Index

this.Neighbours

Full Usage: this.Neighbours

Parameters:
Returns: (Index * 'T) option * 'T option * (Index * 'T) option

Finds the optional neighbour elements in the list for the given index.

index : Index
Returns: (Index * 'T) option * 'T option * (Index * 'T) option

this.NeighboursV

Full Usage: this.NeighboursV

Parameters:
Returns: (Index * 'T) voption * 'T voption * (Index * 'T) voption

Finds the optional neighbour elements in the list for the given index.

index : Index
Returns: (Index * 'T) voption * 'T voption * (Index * 'T) voption

this.NewIndexAfter

Full Usage: this.NewIndexAfter

Parameters:
Returns: Index

Gets an unused index directly after the given one.

index : Index
Returns: Index

this.NewIndexBefore

Full Usage: this.NewIndexBefore

Parameters:
Returns: Index

Gets an unused index directly before the given one.

index : Index
Returns: Index

this.Pairwise

Full Usage: this.Pairwise

Returns: IndexList<'T * 'T>

Returns a list of each element tupled with its successor.

Returns: IndexList<'T * 'T>

this.PairwiseCyclic

Full Usage: this.PairwiseCyclic

Returns: IndexList<'T * 'T>

Returns a list of each element tupled with its successor and the last element tupled with the first.

Returns: IndexList<'T * 'T>

this.PairwiseCyclicV

Full Usage: this.PairwiseCyclicV

Returns: IndexList<'T * 'T>

Returns a list of each element tupled with its successor and the last element tupled with the first.

Returns: IndexList<'T * 'T>

this.PairwiseV

Full Usage: this.PairwiseV

Returns: IndexList<'T * 'T>

Returns a list of each element tupled with its successor.

Returns: IndexList<'T * 'T>

this.Partition

Full Usage: this.Partition

Parameters:
    predicate : Index -> 'T -> bool

Returns: IndexList<'T> * IndexList<'T>

Partitions the IndexList using the predicate.

predicate : Index -> 'T -> bool
Returns: IndexList<'T> * IndexList<'T>

this.Prepend

Full Usage: this.Prepend

Parameters:
    element : 'T

Returns: IndexList<'T>

Prepends the given element to the list.

element : 'T
Returns: IndexList<'T>

this.Remove

Full Usage: this.Remove

Parameters:
    item : 'T

Returns: IndexList<'T>

Removes the first occurrence of the given element (if any).

item : 'T
Returns: IndexList<'T>

this.Remove

Full Usage: this.Remove

Parameters:
Returns: IndexList<'T>

Removes the entry associated to the given index.

index : Index
Returns: IndexList<'T>

this.RemoveAndGetV

Full Usage: this.RemoveAndGetV

Parameters:
Returns: 'T * IndexList<'T>

Removes the entry associated to the given index, returns the value and the list without the specific element or fails if the given index was not found in the list.

index : Index
Returns: 'T * IndexList<'T>

this.RemoveAt

Full Usage: this.RemoveAt

Parameters:
    index : int

Returns: IndexList<'T>

Removes the entry at the given position (if any).

index : int
Returns: IndexList<'T>

this.Set

Full Usage: this.Set

Parameters:
    index : int
    value : 'T

Returns: IndexList<'T>

Updates the element at the given position or returns the unmodified list if the index was out of bounds.

index : int
value : 'T
Returns: IndexList<'T>

this.Set

Full Usage: this.Set

Parameters:
    index : Index
    value : 'T

Returns: IndexList<'T>

Adds or updates the element associated to index.

index : Index
value : 'T
Returns: IndexList<'T>

this.TryDeconstruct

Full Usage: this.TryDeconstruct

Returns: ((Index * 'T) * IndexList<'T>) option

Tries to deconstruct the list. returns its head and tail if successful and None otherwise.

Returns: ((Index * 'T) * IndexList<'T>) option

this.TryDeconstructV

Full Usage: this.TryDeconstructV

Returns: ((Index * 'T) * IndexList<'T>) voption

Tries to deconstruct the list. returns its head and tail if successful and None otherwise.

Returns: ((Index * 'T) * IndexList<'T>) voption

this.TryFind

Full Usage: this.TryFind

Parameters:
    element : 'T

Returns: Index option

Tries to find the smallest index for the given element.

element : 'T
Returns: Index option

this.TryFindV

Full Usage: this.TryFindV

Parameters:
    element : 'T

Returns: Index voption

Tries to find the smallest index for the given element.

element : 'T
Returns: Index voption

this.TryGet

Full Usage: this.TryGet

Parameters:
    i : int

Returns: 'T option

Gets the entry at the given index (if any).

i : int
Returns: 'T option

this.TryGet

Full Usage: this.TryGet

Parameters:
Returns: 'T option

Gets the entry associated to the given index (if any).

i : Index
Returns: 'T option

this.TryGetIndex

Full Usage: this.TryGetIndex

Parameters:
    index : int

Returns: Index option

Gets the index for the given position or None if the index is out of bounds.

index : int
Returns: Index option

this.TryGetIndexV

Full Usage: this.TryGetIndexV

Parameters:
    index : int

Returns: Index voption

Gets the index for the given position or None if the index is out of bounds.

index : int
Returns: Index voption

this.TryGetNext

Full Usage: this.TryGetNext

Parameters:
Returns: (Index * 'T) option

Gets the element directly after index in the list (if any).

index : Index
Returns: (Index * 'T) option

this.TryGetNextV

Full Usage: this.TryGetNextV

Parameters:
Returns: (Index * 'T) voption

Gets the element directly after index in the list (if any).

index : Index
Returns: (Index * 'T) voption

this.TryGetPosition

Full Usage: this.TryGetPosition

Parameters:
Returns: int option

Gets the position for the given index or None if the index is not contained in the list.

index : Index
Returns: int option

this.TryGetPositionV

Full Usage: this.TryGetPositionV

Parameters:
Returns: int voption

Gets the position for the given index or None if the index is not contained in the list.

index : Index
Returns: int voption

this.TryGetPrev

Full Usage: this.TryGetPrev

Parameters:
Returns: (Index * 'T) option

Gets the element directly before index in the list (if any).

index : Index
Returns: (Index * 'T) option

this.TryGetPrevV

Full Usage: this.TryGetPrevV

Parameters:
Returns: (Index * 'T) voption

Gets the element directly before index in the list (if any).

index : Index
Returns: (Index * 'T) voption

this.TryGetV

Full Usage: this.TryGetV

Parameters:
    i : int

Returns: 'T voption

Gets the entry at the given index (if any).

i : int
Returns: 'T voption

this.TryGetV

Full Usage: this.TryGetV

Parameters:
Returns: 'T voption

Gets the entry associated to the given index (if any).

i : Index
Returns: 'T voption

this.TryRemove

Full Usage: this.TryRemove

Parameters:
Returns: ('T * IndexList<'T>) option

Removes the entry associated to the given index, returns the (optional) value and the list without the specific element.

index : Index
Returns: ('T * IndexList<'T>) option

this.TryRemoveV

Full Usage: this.TryRemoveV

Parameters:
Returns: ('T * IndexList<'T>) voption

Removes the entry associated to the given index, returns the (optional) value and the list without the specific element.

index : Index
Returns: ('T * IndexList<'T>) voption

this.Update

Full Usage: this.Update

Parameters:
    index : int
    update : 'T -> 'T

Returns: IndexList<'T>

Updates the element at the given position or returns the unmodified list if the index was out of bounds.

index : int
update : 'T -> 'T
Returns: IndexList<'T>

this.UpdateTo

Full Usage: this.UpdateTo

Parameters:
Returns: IndexList<'T3>

Like choose2 but with existing right values.

other : IndexList<'T2>
mapping : Index -> 'T option -> 'T2 -> 'T3
Returns: IndexList<'T3>

Static members

Static member Description

IndexList.Empty

Full Usage: IndexList.Empty

Returns: IndexList<'T>

The empty list.

Returns: IndexList<'T>

Type something to start searching.