Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Set.IsProperSupersetOf<'T> Method (F#)

Evaluates to true if all elements of the second set are in the first, and at least one element of the first is not in the second.

Namespace/Module Path: Microsoft.FSharp.Collections

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

// Signature:
member this.IsProperSupersetOf : Set<'T> -> bool (requires comparison)

// Usage:
set.IsProperSupersetOf (otherSet)
otherSet

Type: Set<'T>

The set to test against.

true if this set is a proper superset of otherSet. Otherwise, returns false.

The following code illustrates the use of the IsProperSupersetOf method.

let set1 = Set.ofList [ 1 .. 6 ]
let set2 = Set.ofList [ 1 .. 9 ]
let set3 = Set.ofList [ 1 .. 6 ]
let set4 = Set.ofList [ 5 .. 10 ]
printfn "%A is a proper superset of %A: %b" set2 set1 (set2.IsProperSupersetOf set1)
printfn "%A is a proper superset of %A: %b" set3 set1 (set3.IsProperSupersetOf set1) 
printfn "%A is a proper superset of %A: %b" set4 set1 (set4.IsProperSupersetOf set1) 

Output

set [1; 2; 3; 4; 5; 6; 7; 8; 9] is a proper superset of set [1; 2; 3; 4; 5; 6]: true
set [1; 2; 3; 4; 5; 6] is a proper superset of set [1; 2; 3; 4; 5; 6]: false
set [5; 6; 7; 8; 9; 10] is a proper superset of set [1; 2; 3; 4; 5; 6]: false

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

F# Core Library Versions

Supported in: 2.0, 4.0, Portable

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.