다음을 통해 공유


Set.intersectMany<'T> Function (F#)

Computes the intersection of a sequence of sets. The sequence must be non-empty.

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

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

// Signature:
Set.intersectMany : seq<Set<'T>> -> Set<'T> (requires comparison)

// Usage:
Set.intersectMany sets

Parameters

  • sets
    Type: seq<Set<'T>>

    The sequence of sets to intersect.

Return Value

The intersection of the input sets.

Remarks

This function is named IntersectMany 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 example illustrates the use of the Set.intersectMany function.

let seqOfSets =
    seq { for i in 1 .. 9 do yield Set.ofList [ i .. i .. 10000 ] }  
let setResult = Set.intersectMany seqOfSets
printfn "Numbers between 1 and 10,000 that are divisible by "
printfn "all the numbers from 1 to 9:"
printfn "%A" setResult

Output

Numbers between 1 and 10,000 that are divisible by 
all the numbers from 1 to 9:
set [2520; 5040; 7560]

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

Reference

Collections.Set Module (F#)

Microsoft.FSharp.Collections Namespace (F#)