다음을 통해 공유


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

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

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

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

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

// Usage:
Set.isSuperset set1 set2

Parameters

  • set1
    Type: Set<'T>

    The potential superset.

  • set2
    Type: Set<'T>

    The set to test against.

Return Value

true if set1 is a superset of set2. Otherwise, returns false.

Remarks

This function is named IsSuperset 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.isSuperset 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 (Set.isSuperset set2 set1)
printfn "%A is a superset of %A: %b" set3 set1 (Set.isSuperset set3 set1) 
printfn "%A is a superset of %A: %b" set4 set1 (Set.isSuperset set4 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 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

Reference

Collections.Set Module (F#)

Microsoft.FSharp.Collections Namespace (F#)