Set.isProperSubset<'T> 函数 (F#)

如果第一个集合中的所有元素均位于第二个集合中,并且第二个集合中至少有一个元素不在第一个集合中,则计算结果为 true。

命名空间/模块路径: Microsoft.FSharp.Collections.Set

程序集:FSharp.Core(在 FSharp.Core.dll 中)

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

// Usage:
Set.isProperSubset set1 set2

参数

  • set1
    类型:Set<'T>

    潜在子集。

  • set2
    类型:Set<'T>

    要作为测试依据的集合。

返回值

如果 set1 为 set2 的正确子集,则为 true。否则,返回 false。

备注

此函数在编译的程序集中名为 IsProperSubset。如果从 F# 以外的语言中访问函数,或通过反射访问成员,请使用此名称。

示例

下面的代码阐释了 Set.isProperSubset 函数的用法。

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

Output

  

平台

Windows 8,Windows 7,Windows server 2012中,Windows server 2008 R2

版本信息

F#核心库版本

支持:2.0,4.0,可移植

请参见

参考

Collections.Set 模块 (F#)

Microsoft.FSharp.Collections 命名空间 (F#)