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

Seq.tail<'T> Function (F#)

liboz|Last Updated: 8/18/2017
|
1 Contributor

Returns a new sequence by taking the input sequence without its first element.

Namespace/Module Path: Microsoft.FSharp.Collections.Seq

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

Syntax

// Signature:
Seq.tail : seq<'T> -> seq<'T>

// Usage:
Seq.tail source

Parameters

source Type: seq<'T>

The input sequence.

Exceptions

ExceptionCondition
ArgumentExceptionThrown when the input sequence is empty.
ArgumentNullExceptionThrown when the input sequence is null.

Return Value

A sequence consisting of the input sequence without its first element. It is the dual of Seq.head.

Remarks

This function is named Tail in compiled assemblies. If you are accessing the function from a language other than F#, or through reflection, use this name.

Example

The following code shows how to use Seq.tail.

let seq1 = seq { 1..10 }
let seq2 = Seq.empty

//The following line prints seq [2; 3; 4; 5; ...]
printfn "%A" (Seq.tail seq1)

//The following line prints this error message:
//Error: The input sequence has an insufficient number of elements.
//Parameter name: source
printfn "%A" (Seq.tail seq2)

Output

seq [2; 3; 4; 5; ...]
Error: The input sequence has an insufficient number of elements.
Parameter name: source

Platforms

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

Version Information

F# Core Library Versions

Supported in: 4.0, Portable

See Also

Seq.head (F#)

Collections.Seq Module (F#)

Microsoft.FSharp.Collections Namespace (F#)

© 2018 Microsoft