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

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

Den Delimarsky|Last Updated: 8/18/2017
|
1 Contributor

Computes the union of a sequence of sets.

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

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

Syntax

// 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 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

Collections.Set Module (F#)

Microsoft.FSharp.Collections Namespace (F#)

© 2019 Microsoft