LanguageExt.Core

LanguageExt.Core Immutable Collections HashSet

Contents

struct HashSet <A> Source #

Unsorted immutable hash-set

Parameters

type A

Key type

Indexers

this [ A ] Source #

'this' accessor

Parameters

param key

Key

returns

Optional value

Properties

property bool IsEmpty Source #

Is the set empty

property int Count Source #

Number of items in the set

property int Length Source #

Alias of Count

Constructors

constructor HashSet (IEnumerable<A> items) Source #

Ctor that takes an initial (distinct) set of items

Parameters

param items

constructor HashSet (IEnumerable<A> items, bool tryAdd) Source #

Ctor that takes an initial (distinct) set of items

Methods

method Lens<HashSet<A>, bool> item (A key) Source #

Item at index lens

method Lens<HashSet<A>, HashSet<A>> map <B> (Lens<A, A> lens) Source #

Lens map

method HashSet<A> Do (Action<A> f) Source #

Impure iteration of the bound values in the structure

Parameters

returns

Returns the original unmodified structure

method HashSet<R> Map <R> (Func<A, R> mapper) Source #

Maps the values of this set into a new set of values using the mapper function to tranform the source values.

Parameters

type T

Element type

type R

Mapped element type

param set

HSet

param mapper

Mapping function

returns

Mapped enumerable

method HashSet<A> Filter (Func<A, bool> pred) Source #

Filters items from the set using the predicate. If the predicate returns True for any item then it remains in the set, otherwise it's dropped.

Parameters

type T

Element type

param set

HSet

param pred

Predicate

returns

Filtered enumerable

method HashSet<R> Select <R> (Func<A, R> mapper) Source #

Maps the values of this set into a new set of values using the mapper function to tranform the source values.

Parameters

type T

Element type

type R

Mapped element type

param set

HSet

param mapper

Mapping function

returns

Mapped enumerable

method HashSet<A> Where (Func<A, bool> pred) Source #

Filters items from the set using the predicate. If the predicate returns True for any item then it remains in the set, otherwise it's dropped.

Parameters

type T

Element type

param set

HSet

param pred

Predicate

returns

Filtered enumerable

method HashSet<A> Add (A key) Source #

Add an item to the set

Parameters

param value

Value to add to the set

returns

New set with the item added

method HashSet<A> TryAdd (A key) Source #

Attempt to add an item to the set. If an item already exists then return the Set as-is.

Parameters

param value

Value to add to the set

returns

New set with the item maybe added

method HashSet<A> AddOrUpdate (A key) Source #

Add an item to the set. If an item already exists then replace it.

Parameters

param value

Value to add to the set

returns

New set with the item maybe added

method HashSet<A> AddRange (IEnumerable<A> range) Source #

Atomically adds a range of items to the set.

Null is not allowed for a Key

Parameters

param range

Range of keys to add

returns

New HSet with the items added

method HashSet<A> TryAddRange (IEnumerable<A> range) Source #

Atomically adds a range of items to the set. If an item already exists, it's ignored.

Null is not allowed for a Key

Parameters

param range

Range of keys to add

returns

New HSet with the items added

method HashSet<A> AddOrUpdateRange (IEnumerable<A> range) Source #

Atomically adds a range of items to the set. If an item already exists then replace it.

Null is not allowed for a Key

Parameters

param range

Range of keys to add

returns

New HSet with the items added

method HashSet<A> Remove (A key) Source #

Atomically removes an item from the set If the key doesn't exists, the request is ignored.

Parameters

param key

Key

returns

New map with the item removed

method Option<A> Find (A key) Source #

Retrieve a value from the set by key

Parameters

param key

Key to find

returns

Found value

method IEnumerable<A> FindSeq (A key) Source #

Retrieve a value from the set by key as an enumerable

Parameters

param key

Key to find

returns

Found value

method R Find <R> (A key, Func<A, R> Some, Func<R> None) Source #

Retrieve a value from the set by key and pattern match the result.

Parameters

param key

Key to find

returns

Found value

method HashSet<A> SetItem (A key) Source #

Atomically updates an existing item

Null is not allowed for a key

Parameters

param key

Key

returns

New HSet with the item added

method HashSet<A> TrySetItem (A key) Source #

Atomically updates an existing item, unless it doesn't exist, in which case it is ignored

Null is not allowed for a key

Parameters

param key

Key

param value

Value

returns

New HSet with the item added

method bool Contains (A key) Source #

Checks for existence of a key in the set

Parameters

param key

Key to check

returns

True if an item with the key supplied is in the set

method HashSet<A> Clear () Source #

Clears all items from the set

Functionally equivalent to calling HSet.empty as the original structure is untouched

Parameters

returns

Empty HSet

method HashSet<A> SetItems (IEnumerable<A> items) Source #

Atomically sets a series of items

Parameters

param items

Items to set

returns

New HSet with the items set

method HashSet<A> TrySetItems (IEnumerable<A> items) Source #

Atomically sets a series of items. If any of the items don't exist then they're silently ignored.

Parameters

param items

Items to set

returns

New HSet with the items set

method HashSet<A> RemoveRange (IEnumerable<A> keys) Source #

Atomically removes a list of keys from the set

Parameters

param keys

Keys to remove

returns

New HSet with the items removed

method IEnumerator<A> GetEnumerator () Source #

GetEnumerator - IEnumerable interface

method Seq<A> ToSeq () Source #

method string ToString () Source #

Format the collection as [a, b, c, ...] The elipsis is used for collections over 50 items To get a formatted string with all the items, use ToFullString or ToFullArrayString.

method string ToFullString (string separator = ", ") Source #

Format the collection as a, b, c, ...

method string ToFullArrayString (string separator = ", ") Source #

Format the collection as [a, b, c, ...]

method IEnumerable<A> AsEnumerable () Source #

method HashSet<A> Append (HashSet<A> rhs) Source #

method HashSet<A> Subtract (HashSet<A> rhs) Source #

method bool Equals (HashSet<A> other) Source #

Equality

method bool IsProperSubsetOf (IEnumerable<A> other) Source #

Returns True if 'other' is a proper subset of this set

Parameters

returns

True if 'other' is a proper subset of this set

method bool IsProperSupersetOf (IEnumerable<A> other) Source #

Returns True if 'other' is a proper superset of this set

Parameters

returns

True if 'other' is a proper superset of this set

method bool IsSubsetOf (IEnumerable<A> other) Source #

Returns True if 'other' is a superset of this set

Parameters

returns

True if 'other' is a superset of this set

method bool Overlaps (IEnumerable<A> other) Source #

Returns True if other overlaps this set

method bool IsSupersetOf (IEnumerable<A> rhs) Source #

Returns True if 'other' is a superset of this set

Parameters

returns

True if 'other' is a superset of this set

method HashSet<A> Intersect (IEnumerable<A> rhs) Source #

Returns the elements that are in both this and other

method HashSet<A> Except (IEnumerable<A> rhs) Source #

Returns this - other. Only the items in this that are not in other will be returned.

method HashSet<A> SymmetricExcept (HashSet<A> rhs) Source #

Only items that are in one set or the other will be returned. If an item is in both, it is dropped.

method HashSet<A> SymmetricExcept (IEnumerable<A> rhs) Source #

Only items that are in one set or the other will be returned. If an item is in both, it is dropped.

method HashSet<A> Union (IEnumerable<A> rhs) Source #

Finds the union of two sets and produces a new set with the results

Parameters

param other

Other set to union with

returns

A set which contains all items from both sets

method Unit CopyTo (A[] array, int index) Source #

Copy the items from the set into the specified array

Parameters

param array

Array to copy to

param index

Index into the array to start

method Unit CopyTo (System.Array array, int index) Source #

Copy the items from the set into the specified array

Parameters

param array

Array to copy to

param index

Index into the array to start

method bool Equals (object obj) Source #

method int GetHashCode () Source #

method HashSet<B> Bind <B> (Func<A, HashSet<B>> f) Source #

method HashSet<C> SelectMany <B, C> (Func<A, HashSet<B>> bind, Func<A, B, C> project) Source #

Operators

operator + (HashSet<A> lhs, HashSet<A> rhs) Source #

operator - (HashSet<A> lhs, HashSet<A> rhs) Source #

operator == (HashSet<A> lhs, HashSet<A> rhs) Source #

Equality

operator != (HashSet<A> lhs, HashSet<A> rhs) Source #

In-equality

struct HashSet <EqA, A> Source #

where EqA : struct, Eq<A>

Unsorted immutable hash-set

Parameters

type A

Key type

Indexers

this [ A ] Source #

'this' accessor

Parameters

param key

Key

returns

Optional value

Properties

property bool IsEmpty Source #

Is the set empty

property int Count Source #

Number of items in the set

property int Length Source #

Alias of Count

Constructors

constructor HashSet (IEnumerable<A> items) Source #

Ctor that takes an initial (distinct) set of items

Parameters

param items

constructor HashSet (IEnumerable<A> items, bool tryAdd) Source #

Ctor that takes an initial (distinct) set of items

Methods

method Lens<HashSet<EqA, A>, bool> item (A key) Source #

Item at index lens

method Lens<HashSet<EqA, A>, HashSet<EqA, A>> map <B> (Lens<A, A> lens) Source #

Lens map

method HashSet<EqA, A> Do (Action<A> f) Source #

Impure iteration of the bound values in the structure

Parameters

returns

Returns the original unmodified structure

method HashSet<EqR, R> Map <EqR, R> (Func<A, R> mapper) Source #

where EqR : struct, Eq<R>

Maps the values of this set into a new set of values using the mapper function to tranform the source values.

Parameters

type R

Mapped element type

param set

HSet

param mapper

Mapping function

returns

Mapped enumerable

method HashSet<EqA, A> Map (Func<A, A> mapper) Source #

Maps the values of this set into a new set of values using the mapper function to tranform the source values.

Parameters

param set

HSet

param mapper

Mapping function

returns

Mapped enumerable

method HashSet<EqA, A> Filter (Func<A, bool> pred) Source #

Filters items from the set using the predicate. If the predicate returns True for any item then it remains in the set, otherwise it's dropped.

Parameters

type T

Element type

param set

HSet

param pred

Predicate

returns

Filtered enumerable

method HashSet<EqR, R> Select <EqR, R> (Func<A, R> mapper) Source #

where EqR : struct, Eq<R>

Maps the values of this set into a new set of values using the mapper function to tranform the source values.

Parameters

type R

Mapped element type

param set

HSet

param mapper

Mapping function

returns

Mapped enumerable

method HashSet<EqA, A> Where (Func<A, bool> pred) Source #

Filters items from the set using the predicate. If the predicate returns True for any item then it remains in the set, otherwise it's dropped.

Parameters

param set

HSet

param pred

Predicate

returns

Filtered enumerable

method HashSet<EqA, A> Add (A key) Source #

Add an item to the set

Parameters

param value

Value to add to the set

returns

New set with the item added

method HashSet<EqA, A> TryAdd (A key) Source #

Attempt to add an item to the set. If an item already exists then return the Set as-is.

Parameters

param value

Value to add to the set

returns

New set with the item maybe added

method HashSet<EqA, A> AddOrUpdate (A key) Source #

Add an item to the set. If an item already exists then replace it.

Parameters

param value

Value to add to the set

returns

New set with the item maybe added

method HashSet<EqA, A> AddRange (IEnumerable<A> range) Source #

Atomically adds a range of items to the set.

Null is not allowed for a Key

Parameters

param range

Range of keys to add

returns

New HSet with the items added

method HashSet<EqA, A> TryAddRange (IEnumerable<A> range) Source #

Atomically adds a range of items to the set. If an item already exists, it's ignored.

Null is not allowed for a Key

Parameters

param range

Range of keys to add

returns

New HSet with the items added

method HashSet<EqA, A> AddOrUpdateRange (IEnumerable<A> range) Source #

Atomically adds a range of items to the set. If an item already exists then replace it.

Null is not allowed for a Key

Parameters

param range

Range of keys to add

returns

New HSet with the items added

method HashSet<EqA, A> Remove (A key) Source #

Atomically removes an item from the set If the key doesn't exists, the request is ignored.

Parameters

param key

Key

returns

New map with the item removed

method Option<A> Find (A key) Source #

Retrieve a value from the set by key

Parameters

param key

Key to find

returns

Found value

method IEnumerable<A> FindSeq (A key) Source #

Retrieve a value from the set by key as an enumerable

Parameters

param key

Key to find

returns

Found value

method R Find <R> (A key, Func<A, R> Some, Func<R> None) Source #

Retrieve a value from the set by key and pattern match the result.

Parameters

param key

Key to find

returns

Found value

method HashSet<EqA, A> SetItem (A key) Source #

Atomically updates an existing item

Null is not allowed for a key

Parameters

param key

Key

returns

New HSet with the item added

method HashSet<EqA, A> TrySetItem (A key) Source #

Atomically updates an existing item, unless it doesn't exist, in which case it is ignored

Null is not allowed for a key

Parameters

param key

Key

param value

Value

returns

New HSet with the item added

method bool Contains (A key) Source #

Checks for existence of a key in the set

Parameters

param key

Key to check

returns

True if an item with the key supplied is in the set

method HashSet<EqA, A> Clear () Source #

Clears all items from the set

Functionally equivalent to calling HSet.empty as the original structure is untouched

Parameters

returns

Empty HSet

method HashSet<EqA, A> SetItems (IEnumerable<A> items) Source #

Atomically sets a series of items

Parameters

param items

Items to set

returns

New HSet with the items set

method HashSet<EqA, A> TrySetItems (IEnumerable<A> items) Source #

Atomically sets a series of items. If any of the items don't exist then they're silently ignored.

Parameters

param items

Items to set

returns

New HSet with the items set

method HashSet<EqA, A> RemoveRange (IEnumerable<A> keys) Source #

Atomically removes a list of keys from the set

Parameters

param keys

Keys to remove

returns

New HSet with the items removed

method IEnumerator<A> GetEnumerator () Source #

GetEnumerator - IEnumerable interface

method Seq<A> ToSeq () Source #

method string ToString () Source #

Format the collection as [a, b, c, ...] The elipsis is used for collections over 50 items To get a formatted string with all the items, use ToFullString or ToFullArrayString.

method string ToFullString (string separator = ", ") Source #

Format the collection as a, b, c, ...

method string ToFullArrayString (string separator = ", ") Source #

Format the collection as [a, b, c, ...]

method IEnumerable<A> AsEnumerable () Source #

method HashSet<EqA, A> Append (HashSet<EqA, A> rhs) Source #

method HashSet<EqA, A> Subtract (HashSet<EqA, A> rhs) Source #

method bool Equals (HashSet<EqA, A> other) Source #

method bool IsProperSubsetOf (IEnumerable<A> other) Source #

Returns True if 'other' is a proper subset of this set

Parameters

returns

True if 'other' is a proper subset of this set

method bool IsProperSupersetOf (IEnumerable<A> other) Source #

Returns True if 'other' is a proper superset of this set

Parameters

returns

True if 'other' is a proper superset of this set

method bool IsSubsetOf (IEnumerable<A> other) Source #

Returns True if 'other' is a superset of this set

Parameters

returns

True if 'other' is a superset of this set

method bool IsSupersetOf (IEnumerable<A> rhs) Source #

Returns True if 'other' is a superset of this set

Parameters

returns

True if 'other' is a superset of this set

method HashSet<EqA, A> Intersect (IEnumerable<A> rhs) Source #

Returns the elements that are in both this and other

method bool Overlaps (IEnumerable<A> other) Source #

Returns True if other overlaps this set

method HashSet<EqA, A> Except (IEnumerable<A> rhs) Source #

Returns this - other. Only the items in this that are not in other will be returned.

method HashSet<EqA, A> SymmetricExcept (HashSet<EqA, A> rhs) Source #

Only items that are in one set or the other will be returned. If an item is in both, it is dropped.

method HashSet<EqA, A> SymmetricExcept (IEnumerable<A> rhs) Source #

Only items that are in one set or the other will be returned. If an item is in both, it is dropped.

method HashSet<EqA, A> Union (IEnumerable<A> rhs) Source #

Finds the union of two sets and produces a new set with the results

Parameters

param other

Other set to union with

returns

A set which contains all items from both sets

method Unit CopyTo (A[] array, int index) Source #

Copy the items from the set into the specified array

Parameters

param array

Array to copy to

param index

Index into the array to start

method Unit CopyTo (System.Array array, int index) Source #

Copy the items from the set into the specified array

Parameters

param array

Array to copy to

param index

Index into the array to start

method bool Equals (object obj) Source #

method int GetHashCode () Source #

method HashSet<B> Bind <B> (Func<A, HashSet<B>> f) Source #

method HashSet<C> SelectMany <B, C> (Func<A, HashSet<B>> bind, Func<A, B, C> project) Source #

Operators

operator + (HashSet<EqA, A> lhs, HashSet<EqA, A> rhs) Source #

operator - (HashSet<EqA, A> lhs, HashSet<EqA, A> rhs) Source #

operator == (HashSet<EqA, A> lhs, HashSet<EqA, A> rhs) Source #

operator != (HashSet<EqA, A> lhs, HashSet<EqA, A> rhs) Source #

class HashSet Source #

Immutable hash-set module

Methods

method bool isEmpty <T> (HashSet<T> set) Source #

True if the set has no elements

Parameters

type T

Element type

returns

True if the set has no elements

method HashSet<T> create <T> () Source #

Create a new empty set

Parameters

type T

Element type

returns

Empty HSet

method HashSet<T> createRange <T> (IEnumerable<T> range) Source #

Create a new set pre-populated with the items in range

Parameters

type T

Element type

param range

Range of items

returns

HSet

method HashSet<T> empty <T> () Source #

Create a new empty set

Parameters

type T

Element type

returns

Empty HSet

method HashSet<T> add <T> (HashSet<T> set, T value) Source #

Add an item to the set

Parameters

type T

Element type

param set

Set to add item to

param value

Value to add to the HSet

returns

New set with the item added

method HashSet<T> tryAdd <T> (HashSet<T> set, T value) Source #

Attempt to add an item to the set. If an item already exists then return the Set as-is.

Parameters

type T

Element type

param set

Set to add item to

param value

Value to add to the HSet

returns

New set with the item maybe added

method HashSet<T> addOrUpdate <T> (HashSet<T> set, T value) Source #

Add an item to the set. If an item already exists then replace it.

Parameters

type T

Element type

param set

Set to add item to

param value

Value to add to the HSet

returns

New set with the item maybe added

method Option<T> find <T> (HashSet<T> set, T value) Source #

Attempts to find an item in the set.

Parameters

type T

Element type

param set

HSet

param value

Value to find

returns

Some(T) if found, None otherwise

method bool exists <T> (HashSet<T> set, Func<T, bool> pred) Source #

Check the existence of an item in the set using a predicate.

Note this scans the entire set.

Parameters

type T

Element type

param set

HSet

param pred

Predicate

returns

True if predicate returns true for any item

method bool equals <T> (HashSet<T> setA, HashSet<T> setB) Source #

Returns true if both sets contain the same elements

method int length <T> (HashSet<T> set) Source #

Get the number of elements in the set

Parameters

type T

Element type

param set

HSet

returns

Number of elements

method HashSet<T> subtract <T> (HashSet<T> setA, HashSet<T> setB) Source #

Returns setA - setB. Only the items in setA that are not in setB will be returned.

method HashSet<T> union <T> (HashSet<T> setA, HashSet<T> setB) Source #

Finds the union of two sets and produces a new set with the results

Parameters

type T

Element type

param setA

Set A

param setB

Set A

returns

A set which contains all items from both sets

method HashSet<T> filter <T> (HashSet<T> set, Func<T, bool> pred) Source #

Filters items from the set using the predicate. If the predicate returns True for any item then it remains in the set, otherwise it's dropped.

Parameters

type T

Element type

param set

HSet

param pred

Predicate

returns

Filtered enumerable

method S fold <T, S> (HashSet<T> set, S state, Func<S, T, S> folder) Source #

Applies a function 'folder' to each element of the collection, threading an accumulator argument through the computation. The fold function takes the state argument, and applies the function 'folder' to it and the first element of the set. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result. (Aggregate in LINQ)

Parameters

type S

State type

type T

Set element type

param set

Set to fold

param state

Initial state

param folder

Fold function

returns

Aggregate value

method S foldBack <T, S> (HashSet<T> set, S state, Func<S, T, S> folder) Source #

Applies a function 'folder' to each element of the collection (from last element to first), threading an aggregate state through the computation. The fold function takes the state argument, and applies the function 'folder' to it and the first element of the set. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result.

Parameters

type S

State type

type T

Set element type

param set

Set to fold

param state

Initial state

param folder

Fold function

returns

Aggregate value

method HashSet<T> intersect <T> (HashSet<T> setA, IEnumerable<T> setB) Source #

Returns the elements that are in both setA and setB

method HashSet<T> except <T> (HashSet<T> setA, IEnumerable<T> setB) Source #

Returns the elements that are in both setA and setB

method HashSet<T> symmetricExcept <T> (HashSet<T> setA, IEnumerable<T> setB) Source #

Only items that are in one set or the other will be returned. If an item is in both, it is dropped.

method HashSet<R> map <T, R> (HashSet<T> set, Func<T, R> mapper) Source #

Maps the values of this set into a new set of values using the mapper function to tranform the source values.

Parameters

type T

Element type

type R

Mapped element type

param set

HSet

param mapper

Mapping function

returns

Mapped enumerable

method bool contains <T> (HashSet<T> set, T value) Source #

Returns True if the value is in the set

Parameters

type T

Element type

param set

HSet

param value

Value to check

returns

True if the item 'value' is in the Set 'set'

method HashSet<T> remove <T> (HashSet<T> set, T value) Source #

Removes an item from the set (if it exists)

Parameters

type T

Element type

param set

HSet

param value

Value to check

returns

New set with item removed

method bool isSubHSet <T> (HashSet<T> setA, IEnumerable<T> setB) Source #

Returns True if setB is a subset of setA

Parameters

type T

Element type

param setA

Set A

param setB

Set B

returns

True is setB is a subset of setA

method bool isSuperHSet <T> (HashSet<T> setA, IEnumerable<T> setB) Source #

Returns True if setB is a superset of setA

Parameters

type T

Element type

param setA

Set A

param setB

Set B

returns

True is setB is a superset of setA

method bool isProperSubHSet <T> (HashSet<T> setA, IEnumerable<T> setB) Source #

Returns True if setB is a proper subset of setA

Parameters

type T

Element type

param setA

Set A

param setB

Set B

returns

True is setB is a proper subset of setA

method bool isProperSuperHSet <T> (HashSet<T> setA, IEnumerable<T> setB) Source #

Returns True if setB is a proper superset of setA

Parameters

type T

Element type

param setA

Set A

param setB

Set B

returns

True is setB is a proper subset of setA

method bool overlaps <T> (HashSet<T> setA, IEnumerable<T> setB) Source #

Returns True if setA overlaps setB

Parameters

type T

Element type

param setA

Set A

param setB

Set B

returns

True if setA overlaps setB

class HashSet Source #

Immutable hash-set module

Methods

method bool isEmpty <EqT, T> (HashSet<EqT, T> set) Source #

where EqT : struct, Eq<T>

True if the set has no elements

Parameters

type T

Element type

returns

True if the set has no elements

method HashSet<EqT, T> create <EqT, T> () Source #

where EqT : struct, Eq<T>

Create a new empty set

Parameters

type T

Element type

returns

Empty HSet

method HashSet<EqT, T> createRange <EqT, T> (IEnumerable<T> range) Source #

where EqT : struct, Eq<T>

Create a new set pre-populated with the items in range

Parameters

type T

Element type

param range

Range of items

returns

HSet

method HashSet<EqT, T> empty <EqT, T> () Source #

where EqT : struct, Eq<T>

Create a new empty set

Parameters

type T

Element type

returns

Empty HSet

method HashSet<EqT, T> add <EqT, T> (HashSet<EqT, T> set, T value) Source #

where EqT : struct, Eq<T>

Add an item to the set

Parameters

type T

Element type

param set

Set to add item to

param value

Value to add to the HSet

returns

New set with the item added

method HashSet<EqT, T> tryAdd <EqT, T> (HashSet<EqT, T> set, T value) Source #

where EqT : struct, Eq<T>

Attempt to add an item to the set. If an item already exists then return the Set as-is.

Parameters

type T

Element type

param set

Set to add item to

param value

Value to add to the HSet

returns

New set with the item maybe added

method HashSet<EqT, T> addOrUpdate <EqT, T> (HashSet<EqT, T> set, T value) Source #

where EqT : struct, Eq<T>

Add an item to the set. If an item already exists then replace it.

Parameters

type T

Element type

param set

Set to add item to

param value

Value to add to the HSet

returns

New set with the item maybe added

method Option<T> find <EqT, T> (HashSet<EqT, T> set, T value) Source #

where EqT : struct, Eq<T>

Attempts to find an item in the set.

Parameters

type T

Element type

param set

HSet

param value

Value to find

returns

Some(T) if found, None otherwise

method bool exists <EqT, T> (HashSet<EqT, T> set, Func<T, bool> pred) Source #

where EqT : struct, Eq<T>

Check the existence of an item in the set using a predicate.

Note this scans the entire set.

Parameters

type T

Element type

param set

HSet

param pred

Predicate

returns

True if predicate returns true for any item

method bool equals <EqT, T> (HashSet<EqT, T> setA, HashSet<EqT, T> setB) Source #

where EqT : struct, Eq<T>

Returns true if both sets contain the same elements

method int length <EqT, T> (HashSet<EqT, T> set) Source #

where EqT : struct, Eq<T>

Get the number of elements in the set

Parameters

type T

Element type

param set

HSet

returns

Number of elements

method HashSet<EqT, T> subtract <EqT, T> (HashSet<EqT, T> setA, HashSet<EqT, T> setB) Source #

where EqT : struct, Eq<T>

Returns setA - setB. Only the items in setA that are not in setB will be returned.

method HashSet<EqT, T> union <EqT, T> (HashSet<EqT, T> setA, HashSet<EqT, T> setB) Source #

where EqT : struct, Eq<T>

Finds the union of two sets and produces a new set with the results

Parameters

type T

Element type

param setA

Set A

param setB

Set A

returns

A set which contains all items from both sets

method HashSet<EqT, T> filter <EqT, T> (HashSet<EqT, T> set, Func<T, bool> pred) Source #

where EqT : struct, Eq<T>

Filters items from the set using the predicate. If the predicate returns True for any item then it remains in the set, otherwise it's dropped.

Parameters

type T

Element type

param set

HSet

param pred

Predicate

returns

Filtered enumerable

method S fold <EqT, T, S> (HashSet<EqT, T> set, S state, Func<S, T, S> folder) Source #

where EqT : struct, Eq<T>

Applies a function 'folder' to each element of the collection, threading an accumulator argument through the computation. The fold function takes the state argument, and applies the function 'folder' to it and the first element of the set. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result. (Aggregate in LINQ)

Parameters

type S

State type

type T

Set element type

param set

Set to fold

param state

Initial state

param folder

Fold function

returns

Aggregate value

method S foldBack <EqT, T, S> (HashSet<EqT, T> set, S state, Func<S, T, S> folder) Source #

where EqT : struct, Eq<T>

Applies a function 'folder' to each element of the collection (from last element to first), threading an aggregate state through the computation. The fold function takes the state argument, and applies the function 'folder' to it and the first element of the set. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result.

Parameters

type S

State type

type T

Set element type

param set

Set to fold

param state

Initial state

param folder

Fold function

returns

Aggregate value

method HashSet<EqT, T> intersect <EqT, T> (HashSet<EqT, T> setA, HashSet<EqT, T> setB) Source #

where EqT : struct, Eq<T>

Returns the elements that are in both setA and setB

method HashSet<EqT, T> except <EqT, T> (HashSet<EqT, T> setA, HashSet<EqT, T> setB) Source #

where EqT : struct, Eq<T>

Returns the elements that are in both setA and setB

method HashSet<EqT, T> symmetricExcept <EqT, T> (HashSet<EqT, T> setA, HashSet<EqT, T> setB) Source #

where EqT : struct, Eq<T>

Only items that are in one set or the other will be returned. If an item is in both, it is dropped.

method HashSet<EqR, R> map <EqT, EqR, T, R> (HashSet<EqT, T> set, Func<T, R> mapper) Source #

where EqT : struct, Eq<T>
where EqR : struct, Eq<R>

Maps the values of this set into a new set of values using the mapper function to transform the source values.

Parameters

type T

Element type

type R

Mapped element type

param set

HSet

param mapper

Mapping function

returns

Mapped enumerable

method HashSet<EqT, T> map <EqT, T> (HashSet<EqT, T> set, Func<T, T> mapper) Source #

where EqT : struct, Eq<T>

Maps the values of this set into a new set of values using the mapper function to tranform the source values.

Parameters

type T

Element type

type R

Mapped element type

param set

HSet

param mapper

Mapping function

returns

Mapped enumerable

method bool contains <EqT, T> (HashSet<EqT, T> set, T value) Source #

where EqT : struct, Eq<T>

Returns True if the value is in the set

Parameters

type T

Element type

param set

HSet

param value

Value to check

returns

True if the item 'value' is in the Set 'set'

method HashSet<EqT, T> remove <EqT, T> (HashSet<EqT, T> set, T value) Source #

where EqT : struct, Eq<T>

Removes an item from the set (if it exists)

Parameters

type T

Element type

param set

HSet

param value

Value to check

returns

New set with item removed

method bool isSubHSet <EqT, T> (HashSet<EqT, T> setA, HashSet<EqT, T> setB) Source #

where EqT : struct, Eq<T>

Returns True if setB is a subset of setA

Parameters

type T

Element type

param setA

Set A

param setB

Set B

returns

True is setB is a subset of setA

method bool isSuperHSet <EqT, T> (HashSet<EqT, T> setA, HashSet<EqT, T> setB) Source #

where EqT : struct, Eq<T>

Returns True if setB is a superset of setA

Parameters

type T

Element type

param setA

Set A

param setB

Set B

returns

True is setB is a superset of setA

method bool isProperSubHSet <EqT, T> (HashSet<EqT, T> setA, HashSet<EqT, T> setB) Source #

where EqT : struct, Eq<T>

Returns True if setB is a proper subset of setA

Parameters

type T

Element type

param setA

Set A

param setB

Set B

returns

True is setB is a proper subset of setA

method bool isProperSuperHSet <EqT, T> (HashSet<EqT, T> setA, HashSet<EqT, T> setB) Source #

where EqT : struct, Eq<T>

Returns True if setB is a proper superset of setA

Parameters

type T

Element type

param setA

Set A

param setB

Set B

returns

True is setB is a proper subset of setA

method bool overlaps <EqT, T> (HashSet<EqT, T> setA, HashSet<EqT, T> setB) Source #

where EqT : struct, Eq<T>

Returns True if setA overlaps setB

Parameters

type T

Element type

param setA

Set A

param setB

Set B

returns

True if setA overlaps setB