FSharp.Core


List<'T> Type

The type of immutable singly-linked lists.

Use the constructors [] and :: (infix) to create values of this type, or the notation [1;2;3]. Use the values in the List module to manipulate values of this type, or pattern match against the values directly.

Union cases

Union case Description

Head ::Tail

Full Usage: Head ::Tail

Parameters:
    Head : 'T
    Tail : 'T list

Head : 'T
Tail : 'T list

[]

Full Usage: []

Instance members

Instance member Description

this.GetReverseIndex

Full Usage: this.GetReverseIndex

Parameters:
    rank : int - The rank of the index.
    offset : int - The offset from the end.

Returns: int The corresponding index from the start.

Get the index for the element offset elements away from the end of the collection.

rank : int

The rank of the index.

offset : int

The offset from the end.

Returns: int

The corresponding index from the start.

this.GetSlice

Full Usage: this.GetSlice

Parameters:
Returns: 'T list The sub list specified by the input indices.

Gets a slice of the list, the elements of the list from the given start index to the given end index.

startIndex : int option

The start index.

endIndex : int option

The end index.

Returns: 'T list

The sub list specified by the input indices.

this.Head

Full Usage: this.Head

Returns: 'T

Gets the first element of the list

Returns: 'T

this.IsEmpty

Full Usage: this.IsEmpty

Returns: bool

Gets a value indicating if the list contains no entries

Returns: bool

this.[index]

Full Usage: this.[index]

Parameters:
    index : int - The index.

Returns: 'T The value at the given index.

Gets the element of the list at the given position.

Lists are represented as linked lists so this is an O(n) operation.

index : int

The index.

Returns: 'T

The value at the given index.

this.Length

Full Usage: this.Length

Returns: int

Gets the number of items contained in the list

Returns: int

this.Tail

Full Usage: this.Tail

Returns: 'T list

Gets the tail of the list, which is a list containing all the elements of the list, excluding the first element

Returns: 'T list

Static members

Static member Description

List.Cons(head, tail)

Full Usage: List.Cons(head, tail)

Parameters:
    head : 'T - A new head value for the list.
    tail : 'T list - The existing list.

Returns: 'T list The list with head appended to the front of tail.

Returns a list with head as its first element and tail as its subsequent elements

head : 'T

A new head value for the list.

tail : 'T list

The existing list.

Returns: 'T list

The list with head appended to the front of tail.

List.Empty

Full Usage: List.Empty

Returns: 'T list

Returns an empty list of a particular type

Returns: 'T list