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

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

Den Delimarsky|Last Updated: 7/25/2016
|
1 Contributor

Computes the union of the two sets.

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

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

Syntax

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

// Usage:
Set.union set1 set2

Parameters

set1 Type: Set<'T>

The first input set.

set2 Type: Set<'T>

The second input set.

Return Value

The union of set1 and set2.

Remarks

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

Example


let set1 = Set.ofList [ 2 .. 2 .. 8 ]
let set2 = Set.ofList [ 1 .. 2 .. 9 ]
let set3 = Set.union set1 set2
printfn "%A union %A yields %A" set1 set2 set3

Output

set [2; 4; 6; 8] union set [1; 3; 5; 7; 9] yields set [1; 2; 3; 4; 5; 6; 7; 8; 9]

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#)

© 2017 Microsoft