Share via


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

Computes the union of a sequence of sets.

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

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

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

// Usage:
Set.unionMany sets

Parameters

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

    The sequence of sets to union.

Return Value

The union of the input sets.

Remarks

This function is named UnionMany 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 illustrates the use of the Set.unionMany function.

    let seqOfSets =
        seq { for i in 2 .. 5 do yield Set.ofList [ i .. i .. 40 ] }  
    let setResult = Set.unionMany seqOfSets
    printfn "Numbers up to 40 that are multiples of numbers from 2 to 5:"
    Set.iter (fun elem -> printf "%d " elem) setResult

Output

Numbers up to 40 that are multiples of numbers from 2 to 5:
2 3 4 5 6 8 9 10 12 14 15 16 18 20 21 22 24 25 26 27 28 30 32 33 34 35 36 38 39 40 

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.Set Module (F#)

Microsoft.FSharp.Collections Namespace (F#)