Поделиться через


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

Evaluates to true if all elements of the second set are in the first.

Namespace/Module Path: Microsoft.FSharp.Collections

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

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

// Usage:
set.IsSupersetOf (otherSet)

Parameters

  • otherSet
    Type: Set<'T>

    The set to test against.

Return Value

true if this set is a superset of otherSet.

Example

The following code illustrates the use of the IsSupersetOf 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 superset of %A: %b" set2 set1 (set2.IsSupersetOf set1)
printfn "%A is a superset of %A: %b" set3 set1 (set3.IsSupersetOf set1) 
printfn "%A is a superset of %A: %b" set4 set1 (set4.IsSupersetOf set1) 

Output

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

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<'T> Class (F#)

Microsoft.FSharp.Collections Namespace (F#)