Share via


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

Returns a sequence that, when iterated, skips elements of the underlying sequence while the given predicate returns true, and then yields the remaining elements of the sequence.

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

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

// Signature:
Seq.skipWhile : ('T -> bool) -> seq<'T> -> seq<'T>

// Usage:
Seq.skipWhile predicate source

Parameters

  • predicate
    Type: 'T -> bool

    A function that evaluates an element of the sequence to a Boolean value.

  • source
    Type: seq<'T>

    The input sequence.

Exceptions

Exception

Condition

ArgumentNullException

Thrown when the input sequence is null.

Return Value

The result sequence.

Remarks

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

Example

The following example demonstrates the use of Seq.skipWhile. The resulting sequences contains only elements that are greater than 10.

let mySeq = seq { for i in 1 .. 10 -> i*i }
let printSeq seq1 = Seq.iter (printf "%A ") seq1; printfn ""
let mySeqSkipWhileLessThan10 = Seq.skipWhile (fun elem -> elem < 10) mySeq
mySeqSkipWhileLessThan10 |> printSeq
16 25 36 49 64 81 100 

Platforms

Windows 7, Windows Vista SP2, Windows XP SP3, Windows XP x64 SP2, Windows Server 2008 R2, Windows Server 2008 SP2, Windows Server 2003 SP2

Version Information

F# Runtime

Supported in: 2.0, 4.0

Silverlight

Supported in: 3

See Also

Reference

Collections.Seq Module (F#)

Microsoft.FSharp.Collections Namespace (F#)