Table of contents
TOC
Collapse the table of content
Expand the table of content

Collections.List<'T> Union (F#)

Den Delimarsky|Last Updated: 8/18/2017
|
1 Contributor

The type of immutable singly-linked lists.

Namespace/Module Path: Microsoft.FSharp.Collections

Assembly: FSharp.Core (in FSharp.Core.dll)

Syntax

[<DefaultAugmentation(false)>]
[<StructuralEquality>]
[<StructuralComparison>]
type List<'T> =
| ( [] )
| ( :: ) of 'T * 'T list
with
interface IStructuralEquatable
interface IComparable
interface IComparable
interface IStructuralComparable
interface IEnumerable
interface IEnumerable
static member List.Cons : 'T * 'T list -> 'T list
static member List.Empty :  'T list
member this.Head :  'T
member this.IsEmpty :  bool
member this.Item (int) :  'T
member this.Length :  int
member this.Tail :  'T list
end

Remarks

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.

This type is named FSharpList in the .NET assembly. If accessing the type from a .NET language other than F#, or through reflection, use this name.

Instance Members

MemberDescription
HeadGets the first element of the list.
IsEmptyGets a value indicating if the list contains no entries.
ItemGets the element of the list at the given position.
LengthGets the number of items contained in the list.
TailGets the tail of the list, which is a list containing all the elements of the list, excluding the first element.

Static Members

MemberDescription
ConsReturns a list with the first argument as its first element and the second argument as its subsequent elements.
EmptyReturns an empty list of a particular type.

Union Cases

CaseDescription
( :: ) of 'T * 'T listThe cons operator.
( [] )The empty list.

Platforms

Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2

Version Information

F# Core Library Versions

Supported in: 2.0, 4.0, Portable

See Also

Microsoft.FSharp.Collections Namespace (F#)

Collections.List Module (F#)

© 2017 Microsoft