Export (0) Print
Expand All

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

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

Namespace/Module Path: Microsoft.FSharp.Collections

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

[<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

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.

Member

Description

new

Create a set containing elements drawn from the given sequence.

Member

Description

Add

A 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.

Contains

A useful shortcut for Set.contains. See the Set module for further operations on sets.

Count

The number of elements in the set

IsEmpty

A useful shortcut for Set.isEmpty.

IsProperSubsetOf

Evaluates 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.

IsProperSupersetOf

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.

IsSubsetOf

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

IsSupersetOf

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

MaximumElement

Returns the highest element in the set according to the ordering being used for the set.

MinimumElement

Returns the lowest element in the set according to the ordering being used for the set.

Remove

A 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.

Member

Description

( + )

Compute the union of the two sets.

( - )

Returns a new set with the elements of the second set removed from the first.

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

F# Core Library Versions

Supported in: 2.0, 4.0, Portable

Show:
© 2014 Microsoft