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

Collections.Set<'T> Class (F#)

Den Delimarsky|Last Updated: 7/1/2016
|
2 Contributors

Immutable sets based on binary trees, where comparison is the F# structural comparison function, potentially using implementations of the System.IComparable interface on key values.

Namespace/Module Path: Microsoft.FSharp.Collections

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

Syntax

[<Sealed>]
type Set<[<EqualityConditionalOnAttribute>] 'T (requires comparison)> =
class
interface IComparable
interface IEnumerable
interface IEnumerable
interface ICollection
new Set : seq<'T> -> Set<'T>
member this.Add : 'T -> Set<'T>
member this.Contains : 'T -> bool
member this.IsProperSubsetOf : Set<'T> -> bool
member this.IsProperSupersetOf : Set<'T> -> bool
member this.IsSubsetOf : Set<'T> -> bool
member this.IsSupersetOf : Set<'T> -> bool
member this.Remove : 'T -> Set<'T>
member this.Count :  int
member this.IsEmpty :  bool
member this.MaximumElement :  'T
member this.MinimumElement :  'T
static member ( + ) : Set<'T> * Set<'T> -> Set<'T>
static member ( - ) : Set<'T> * Set<'T> -> Set<'T>
end

Remarks

See the Set module for further operations on sets. All members of this class are thread-safe and may be used concurrently from multiple threads.

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

Constructors

MemberDescription
newCreate a set containing elements drawn from the given sequence.

Instance Members

MemberDescription
AddA useful shortcut for Set.add. Note this operation produces a new set and does not mutate the original set. The new set will share many storage nodes with the original.
ContainsA useful shortcut for Set.contains. See the Set module for further operations on sets.
CountThe number of elements in the set
IsEmptyA useful shortcut for Set.isEmpty.
IsProperSubsetOfEvaluates to true if all elements of the first set are in the second, and at least one element of the second is not in the first.
IsProperSupersetOfEvaluates 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.
IsSubsetOfEvaluates to true if all elements of the first set are in the second.
IsSupersetOfEvaluates to true if all elements of the second set are in the first.
MaximumElementReturns the highest element in the set according to the ordering being used for the set.
MinimumElementReturns the lowest element in the set according to the ordering being used for the set.
RemoveA useful shortcut for Set.remove. Note this operation produces a new set and does not mutate the original set. The new set will share many storage nodes with the original.

Static Members

MemberDescription
( + )Compute the union of the two sets.
( - )Returns a new set with the elements of the second set removed from the first.

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

Microsoft.FSharp.Collections Namespace (F#)

Collections.Set Module (F#)

© 2016 Microsoft