Export (0) Print
Expand All

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

sets

Type: seq<Set<'T>>

The sequence of sets to intersect.

The intersection of the input sets.

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.

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]

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

F# Core Library Versions

Supported in: 2.0, 4.0, Portable

Show:
© 2014 Microsoft