[Home] Type Microsoft.FSharp.Collections.Set


Immutable sets based on binary trees, where comparison is the F# structural comparison function, potentially using implementations of the IComparable interface on key values. See the Set module for further operations on sets. These sets can be used with elements of any type, but you should check that structural hashing and equality on the element type are correct for your type.

Full Type Signature

[<SealedAttribute ()>]
type Set<'a> =
  class
    interface IStructuralHash
    interface IComparable
    interface IEnumerable
    interface IEnumerable<'a>
    interface ICollection<'a>
    new : seq<'a> -> Set<'a>
    member Add : 'a -> Set<'a>
    member Contains : 'a -> bool
    member IsSubsetOf : Set<'a> -> bool
    member IsSupersetOf : Set<'a> -> bool
    member Remove : 'a -> Set<'a>
    member Count : int
    member IsEmpty : bool
    static member ( + ) : Set<'a> * Set<'a> -> Set<'a>
    static member ( - ) : Set<'a> * Set<'a> -> Set<'a>
  end

Instance Members

MemberDescription
member Add : 'a -> Set<'a>
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. See the Set module for further operations on sets.
member Contains : 'a -> bool
A useful shortcut for Set.mem. See the Set module for further operations on sets.
member Count : int
The number of elements in the set
override Equals : obj -> bool
member IsEmpty : bool
A useful shortcut for Set.is_empty. See the Set module for further operations on sets.
member IsSubsetOf : Set<'a> -> bool
Evaluates to "true" if all elements of the second set are in the first
member IsSupersetOf : Set<'a> -> bool
Evaluates to "true" if all elements of the first set are in the second
member Remove : 'a -> Set<'a>
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. See the Set module for further operations on sets.

Static Members

MemberDescription
member ( + ) : Set<'a> * Set<'a> -> Set<'a>
Compute the union of the two sets.
member ( - ) : Set<'a> * Set<'a> -> Set<'a>
Return a new set with the elements of the second set removed from the first.
new : seq<'a> -> Set<'a>
Create a set containing elements drawn from the given sequence.

See Also

Microsoft.FSharp.Collections


Documentation for assembly FSharp.Core, version 1.9.6.0, generated using F# Programming Language version 1.9.6.0