- Set <A>
- Empty = new Set<A>(SetInternal<OrdDefault<A>, A>.Empty)
- Set (IEnumerable<A> items)
- Set (IEnumerable<A> items, bool tryAdd)
- item (A key)
- map <B> (Lens<A, A> lens)
- Case
- Add (A value)
- TryAdd (A value)
- AddOrUpdate (A value)
- AddRange (IEnumerable<A> range)
- TryAddRange (IEnumerable<A> range)
- AddOrUpdateRange (IEnumerable<A> range)
- Find (A value)
- FindRange (A keyFrom, A keyTo)
- FindPredecessor (A key)
- FindExactOrPredecessor (A key)
- FindSuccessor (A key)
- FindExactOrSuccessor (A key)
- Intersect (IEnumerable<A> other)
- Except (IEnumerable<A> other)
- Except (Set<A> other)
- SymmetricExcept (IEnumerable<A> other)
- SymmetricExcept (Set<A> other)
- Union (IEnumerable<A> other)
- Clear ()
- GetEnumerator ()
- Remove (A value)
- RemoveRange (IEnumerable<A> values)
- Fold <S> (S state, Func<S, A, S> folder)
- FoldBack <S> (S state, Func<S, A, S> folder)
- Do (Action<A> f)
- Map <B> (Func<A, B> map)
- Filter (Func<A, bool> pred)
- Exists (Func<A, bool> pred)
- Contains (A value)
- SetEquals (IEnumerable<A> other)
- IsEmpty
- Count
- Length
- IsProperSubsetOf (IEnumerable<A> other)
- IsProperSupersetOf (IEnumerable<A> other)
- IsSubsetOf (IEnumerable<A> other)
- IsSupersetOf (IEnumerable<A> other)
- Overlaps (IEnumerable<A> other)
- CopyTo (A[] array, int index)
- CopyTo (System.Array array, int index)
- + (Set<A> lhs, Set<A> rhs)
- Append (Set<A> rhs)
- - (Set<A> lhs, Set<A> rhs)
- Subtract (Set<A> rhs)
- Equals (Set<A> other)
- == (Set<A> lhs, Set<A> rhs)
- != (Set<A> lhs, Set<A> rhs)
- < (Set<A> lhs, Set<A> rhs)
- <= (Set<A> lhs, Set<A> rhs)
- > (Set<A> lhs, Set<A> rhs)
- >= (Set<A> lhs, Set<A> rhs)
- Equals (object obj)
- GetHashCode ()
- CompareTo (object obj)
- ToString ()
- ToFullString (string separator = ", ")
- ToFullArrayString (string separator = ", ")
- ToSeq ()
- AsEnumerable ()
- Select <B> (Func<A, B> f)
- Where (Func<A, bool> pred)
- Bind <B> (Func<A, Set<B>> f)
- SelectMany <B, C> (Func<A, Set<B>> bind, Func<A, B, C> project)
- Skip (int amount)
- CompareTo (Set<A> other)
- CompareTo <OrdA> (Set<A> other)
- Slice (A keyFrom, A keyTo)
- Min
- Max
- SetExtensions
- Aggregate <TSource, TAccumulate> (this Set<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> func)
- Aggregate <TSource, TAccumulate, TResult> (this Set<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> func, Func<TAccumulate, TResult> resultSelector)
- Aggregate <TSource> (this Set<TSource> source, Func<TSource, TSource, TSource> func)
- All <TSource> (this Set<TSource> source, Func<TSource, bool> predicate)
- Any <TSource> (this Set<TSource> source)
- Any <TSource> (this Set<TSource> source, Func<TSource, bool> predicate)
- AsEnumerable <TSource> (this Set<TSource> source)
- AsQueryable <TElement> (this Set<TElement> source)
- Average (this Set<decimal> source)
- Average <TSource> (this Set<TSource> source, Func<TSource, decimal> selector)
- Average (this Set<decimal?> source)
- Average <TSource> (this Set<TSource> source, Func<TSource, decimal?> selector)
- Average (this Set<double> source)
- Average (this Set<int> source)
- Average (this Set<long> source)
- Average <TSource> (this Set<TSource> source, Func<TSource, double> selector)
- Average <TSource> (this Set<TSource> source, Func<TSource, int> selector)
- Average <TSource> (this Set<TSource> source, Func<TSource, long> selector)
- Average (this Set<double?> source)
- Average (this Set<int?> source)
- Average (this Set<long?> source)
- Average <TSource> (this Set<TSource> source, Func<TSource, double?> selector)
- Average <TSource> (this Set<TSource> source, Func<TSource, int?> selector)
- Average <TSource> (this Set<TSource> source, Func<TSource, long?> selector)
- Average (this Set<float> source)
- Average <TSource> (this Set<TSource> source, Func<TSource, float> selector)
- Average (this Set<float?> source)
- Average <TSource> (this Set<TSource> source, Func<TSource, float?> selector)
- Concat <TSource> (this Set<TSource> first, IEnumerable<TSource> second)
- Contains <TSource> (this Set<TSource> source, TSource value)
- Contains <TSource> (this Set<TSource> source, TSource value, IEqualityComparer<TSource> comparer)
- Count <TSource> (this Set<TSource> source)
- Count <TSource> (this Set<TSource> source, Func<TSource, bool> predicate)
- DefaultIfEmpty <TSource> (this Set<TSource> source)
- DefaultIfEmpty <TSource> (this Set<TSource> source, TSource defaultValue)
- Distinct <TSource> (this Set<TSource> source)
- Distinct <TSource> (this Set<TSource> source, IEqualityComparer<TSource> comparer)
- ElementAt <TSource> (this Set<TSource> source, int index)
- ElementAtOrDefault <TSource> (this Set<TSource> source, int index)
- Except <TSource> (this Set<TSource> first, IEnumerable<TSource> second)
- Except <TSource> (this Set<TSource> first, IEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
- First <TSource> (this Set<TSource> source)
- First <TSource> (this Set<TSource> source, Func<TSource, bool> predicate)
- FirstOrDefault <TSource> (this Set<TSource> source)
- FirstOrDefault <TSource> (this Set<TSource> source, Func<TSource, bool> predicate)
- GroupBy <TSource, TKey, TElement> (this Set<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector)
- GroupBy <TSource, TKey, TElement> (this Set<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer)
- GroupBy <TSource, TKey> (this Set<TSource> source, Func<TSource, TKey> keySelector)
- GroupBy <TSource, TKey> (this Set<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
- GroupBy <TSource, TKey, TElement, TResult> (this Set<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<TKey, IEnumerable<TElement>, TResult> resultSelector)
- GroupBy <TSource, TKey, TElement, TResult> (this Set<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<TKey, IEnumerable<TElement>, TResult> resultSelector, IEqualityComparer<TKey> comparer)
- GroupBy <TSource, TKey, TResult> (this Set<TSource> source, Func<TSource, TKey> keySelector, Func<TKey, IEnumerable<TSource>, TResult> resultSelector)
- GroupBy <TSource, TKey, TResult> (this Set<TSource> source, Func<TSource, TKey> keySelector, Func<TKey, IEnumerable<TSource>, TResult> resultSelector, IEqualityComparer<TKey> comparer)
- GroupJoin <TOuter, TInner, TKey, TResult> (this Set<TOuter> outer, IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, IEnumerable<TInner>, TResult> resultSelector)
- GroupJoin <TOuter, TInner, TKey, TResult> (this Set<TOuter> outer, IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, IEnumerable<TInner>, TResult> resultSelector, IEqualityComparer<TKey> comparer)
- Intersect <TSource> (this Set<TSource> first, IEnumerable<TSource> second)
- Intersect <TSource> (this Set<TSource> first, IEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
- Join <TOuter, TInner, TKey, TResult> (this Set<TOuter> outer, IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, TInner, TResult> resultSelector)
- Join <TOuter, TInner, TKey, TResult> (this Set<TOuter> outer, IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, TInner, TResult> resultSelector, IEqualityComparer<TKey> comparer)
- Last <TSource> (this Set<TSource> source)
- Last <TSource> (this Set<TSource> source, Func<TSource, bool> predicate)
- LastOrDefault <TSource> (this Set<TSource> source)
- LastOrDefault <TSource> (this Set<TSource> source, Func<TSource, bool> predicate)
- LongCount <TSource> (this Set<TSource> source)
- LongCount <TSource> (this Set<TSource> source, Func<TSource, bool> predicate)
- Max (this Set<decimal> source)
- Max <TSource> (this Set<TSource> source, Func<TSource, decimal> selector)
- Max (this Set<decimal?> source)
- Max <TSource> (this Set<TSource> source, Func<TSource, decimal?> selector)
- Max (this Set<double> source)
- Max <TSource> (this Set<TSource> source, Func<TSource, double> selector)
- Max (this Set<double?> source)
- Max <TSource> (this Set<TSource> source, Func<TSource, double?> selector)
- Max (this Set<float> source)
- Max <TSource> (this Set<TSource> source, Func<TSource, float> selector)
- Max (this Set<float?> source)
- Max <TSource> (this Set<TSource> source, Func<TSource, float?> selector)
- Max (this Set<int> source)
- Max <TSource> (this Set<TSource> source, Func<TSource, int> selector)
- Max (this Set<int?> source)
- Max <TSource> (this Set<TSource> source, Func<TSource, int?> selector)
- Max (this Set<long> source)
- Max <TSource> (this Set<TSource> source, Func<TSource, long> selector)
- Max (this Set<long?> source)
- Max <TSource> (this Set<TSource> source, Func<TSource, long?> selector)
- Max <TSource, TResult> (this Set<TSource> source, Func<TSource, TResult> selector)
- Max <TSource> (this Set<TSource> source)
- Min (this Set<decimal> source)
- Min <TSource> (this Set<TSource> source, Func<TSource, decimal> selector)
- Min (this Set<decimal?> source)
- Min <TSource> (this Set<TSource> source, Func<TSource, decimal?> selector)
- Min (this Set<double> source)
- Min <TSource> (this Set<TSource> source, Func<TSource, double> selector)
- Min (this Set<double?> source)
- Min <TSource> (this Set<TSource> source, Func<TSource, double?> selector)
- Min (this Set<float> source)
- Min <TSource> (this Set<TSource> source, Func<TSource, float> selector)
- Min (this Set<float?> source)
- Min <TSource> (this Set<TSource> source, Func<TSource, float?> selector)
- Min (this Set<int> source)
- Min <TSource> (this Set<TSource> source, Func<TSource, int> selector)
- Min (this Set<int?> source)
- Min <TSource> (this Set<TSource> source, Func<TSource, int?> selector)
- Min (this Set<long> source)
- Min <TSource> (this Set<TSource> source, Func<TSource, long> selector)
- Min (this Set<long?> source)
- Min <TSource> (this Set<TSource> source, Func<TSource, long?> selector)
- Min <TSource, TResult> (this Set<TSource> source, Func<TSource, TResult> selector)
- Min <TSource> (this Set<TSource> source)
- OrderBy <TSource, TKey> (this Set<TSource> source, Func<TSource, TKey> keySelector)
- OrderBy <TSource, TKey> (this Set<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer)
- OrderByDescending <TSource, TKey> (this Set<TSource> source, Func<TSource, TKey> keySelector)
- OrderByDescending <TSource, TKey> (this Set<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer)
- Reverse <TSource> (this Set<TSource> source)
- SequenceEqual <TSource> (this Set<TSource> first, IEnumerable<TSource> second)
- SequenceEqual <TSource> (this Set<TSource> first, IEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
- Single <TSource> (this Set<TSource> source)
- Single <TSource> (this Set<TSource> source, Func<TSource, bool> predicate)
- SingleOrDefault <TSource> (this Set<TSource> source)
- SingleOrDefault <TSource> (this Set<TSource> source, Func<TSource, bool> predicate)
- Skip <TSource> (this Set<TSource> source, int count)
- SkipWhile <TSource> (this Set<TSource> source, Func<TSource, bool> predicate)
- SkipWhile <TSource> (this Set<TSource> source, Func<TSource, int, bool> predicate)
- Sum (this Set<decimal> source)
- Sum <TSource> (this Set<TSource> source, Func<TSource, decimal> selector)
- Sum (this Set<decimal?> source)
- Sum <TSource> (this Set<TSource> source, Func<TSource, decimal?> selector)
- Sum (this Set<double> source)
- Sum <TSource> (this Set<TSource> source, Func<TSource, double> selector)
- Sum (this Set<double?> source)
- Sum <TSource> (this Set<TSource> source, Func<TSource, double?> selector)
- Sum (this Set<float> source)
- Sum <TSource> (this Set<TSource> source, Func<TSource, float> selector)
- Sum (this Set<float?> source)
- Sum <TSource> (this Set<TSource> source, Func<TSource, float?> selector)
- Sum (this Set<int> source)
- Sum <TSource> (this Set<TSource> source, Func<TSource, int> selector)
- Sum (this Set<int?> source)
- Sum <TSource> (this Set<TSource> source, Func<TSource, int?> selector)
- Sum (this Set<long> source)
- Sum <TSource> (this Set<TSource> source, Func<TSource, long> selector)
- Sum (this Set<long?> source)
- Sum <TSource> (this Set<TSource> source, Func<TSource, long?> selector)
- Take <TSource> (this Set<TSource> source, int count)
- TakeWhile <TSource> (this Set<TSource> source, Func<TSource, bool> predicate)
- TakeWhile <TSource> (this Set<TSource> source, Func<TSource, int, bool> predicate)
- ToArray <TSource> (this Set<TSource> source)
- ToDictionary <TSource, TKey, TElement> (this Set<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector)
- ToDictionary <TSource, TKey, TElement> (this Set<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer)
- ToDictionary <TSource, TKey> (this Set<TSource> source, Func<TSource, TKey> keySelector)
- ToDictionary <TSource, TKey> (this Set<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
- ToList <TSource> (this Set<TSource> source)
- ToLookup <TSource, TKey, TElement> (this Set<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector)
- ToLookup <TSource, TKey, TElement> (this Set<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer)
- ToLookup <TSource, TKey> (this Set<TSource> source, Func<TSource, TKey> keySelector)
- ToLookup <TSource, TKey> (this Set<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
- Union <TSource> (this Set<TSource> first, IEnumerable<TSource> second)
- Union <TSource> (this Set<TSource> first, IEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
- Zip <TFirst, TSecond, TResult> (this Set<TFirst> first, IEnumerable<TSecond> second, Func<TFirst, TSecond, TResult> resultSelector)
- AddOpt
- SetEnumerator <K>
- Set
- isEmpty <T> (Set<T> set)
- create <T> ()
- createRange <T> (IEnumerable<T> range)
- empty <T> ()
- add <T> (Set<T> set, T value)
- tryAdd <T> (Set<T> set, T value)
- addOrUpdate <T> (Set<T> set, T value)
- addRange <A> (Set<A> set, IEnumerable<A> range)
- tryAddRange <A> (Set<A> set, IEnumerable<A> range)
- addOrUpdateRange <A> (Set<A> set, IEnumerable<A> range)
- find <T> (Set<T> set, T value)
- exists <T> (Set<T> set, Func<T, bool> pred)
- equals <T> (Set<T> setA, Set<T> setB)
- length <T> (Set<T> set)
- subtract <T> (Set<T> setA, Set<T> setB)
- union <T> (Set<T> setA, Set<T> setB)
- filter <T> (Set<T> set, Func<T, bool> pred)
- fold <T, S> (Set<T> set, S state, Func<S, T, S> folder)
- foldBack <T, S> (Set<T> set, S state, Func<S, T, S> folder)
- intersect <T> (Set<T> setA, IEnumerable<T> setB)
- except <T> (Set<T> setA, IEnumerable<T> setB)
- symmetricExcept <T> (Set<T> setA, IEnumerable<T> setB)
- map <T, R> (Set<T> set, Func<T, R> mapper)
- contains <T> (Set<T> set, T value)
- remove <T> (Set<T> set, T value)
- isSubset <T> (Set<T> setA, IEnumerable<T> setB)
- isSuperset <T> (Set<T> setA, IEnumerable<T> setB)
- isProperSubset <T> (Set<T> setA, IEnumerable<T> setB)
- isProperSuperset <T> (Set<T> setA, IEnumerable<T> setB)
- overlaps <T> (Set<T> setA, IEnumerable<T> setB)
- Set <OrdA, A>
- Empty = new Set<OrdA, A>(SetInternal<OrdA, A>.Empty)
- Set (IEnumerable<A> items)
- Set (IEnumerable<A> items, bool tryAdd)
- Case
- Add (A value)
- TryAdd (A value)
- AddOrUpdate (A value)
- AddRange (IEnumerable<A> range)
- TryAddRange (IEnumerable<A> range)
- AddOrUpdateRange (IEnumerable<A> range)
- Find (A value)
- FindPredecessor (A key)
- FindExactOrPredecessor (A key)
- FindSuccessor (A key)
- FindExactOrSuccessor (A key)
- FindRange (A keyFrom, A keyTo)
- Intersect (Set<OrdA, A> other)
- Except (Set<OrdA, A> other)
- Except (IEnumerable<A> other)
- SymmetricExcept (Set<OrdA, A> other)
- SymmetricExcept (IEnumerable<A> other)
- Union (Set<OrdA, A> other)
- Clear ()
- GetEnumerator ()
- Remove (A value)
- Fold <S> (S state, Func<S, A, S> folder)
- FoldBack <S> (S state, Func<S, A, S> folder)
- Do (Action<A> f)
- Map <OrdB, B> (Func<A, B> map)
- Map (Func<A, A> map)
- Filter (Func<A, bool> pred)
- Exists (Func<A, bool> pred)
- Contains (A value)
- SetEquals (Set<OrdA, A> other)
- IsEmpty
- Count
- Length
- IsProperSubsetOf (Set<OrdA, A> other)
- IsProperSupersetOf (Set<OrdA, A> other)
- IsSubsetOf (Set<OrdA, A> other)
- IsSupersetOf (Set<OrdA, A> other)
- Overlaps (Set<OrdA, A> other)
- CopyTo (A[] array, int index)
- CopyTo (System.Array array, int index)
- + (Set<OrdA, A> lhs, Set<OrdA, A> rhs)
- Append (Set<OrdA, A> rhs)
- - (Set<OrdA, A> lhs, Set<OrdA, A> rhs)
- Subtract (Set<OrdA, A> rhs)
- Equals (Set<OrdA, A> other)
- == (Set<OrdA, A> lhs, Set<OrdA, A> rhs)
- != (Set<OrdA, A> lhs, Set<OrdA, A> rhs)
- < (Set<OrdA, A> lhs, Set<OrdA, A> rhs)
- <= (Set<OrdA, A> lhs, Set<OrdA, A> rhs)
- > (Set<OrdA, A> lhs, Set<OrdA, A> rhs)
- >= (Set<OrdA, A> lhs, Set<OrdA, A> rhs)
- Equals (object obj)
- GetHashCode ()
- ToString ()
- ToSeq ()
- AsEnumerable ()
- Where (Func<A, bool> pred)
- Bind <OrdB, B> (Func<A, Set<OrdB, B>> f)
- Bind (Func<A, Set<OrdA, A>> f)
- Skip (int amount)
- CompareTo (Set<OrdA, A> other)
- Slice (A keyFrom, A keyTo)
- Min
- Max
- Set
- isEmpty <OrdT, T> (Set<OrdT, T> set)
- create <OrdT, T> ()
- createRange <OrdT, T> (IEnumerable<T> range)
- empty <OrdT, T> ()
- add <OrdT, T> (Set<OrdT, T> set, T value)
- tryAdd <OrdT, T> (Set<OrdT, T> set, T value)
- addOrUpdate <OrdT, T> (Set<OrdT, T> set, T value)
- addRange <OrdT, T> (Set<OrdT, T> set, IEnumerable<T> range)
- tryAddRange <OrdT, T> (Set<OrdT, T> set, IEnumerable<T> range)
- addOrUpdateRange <OrdT, T> (Set<OrdT, T> set, IEnumerable<T> range)
- find <OrdT, T> (Set<OrdT, T> set, T value)
- exists <OrdT, T> (Set<OrdT, T> set, Func<T, bool> pred)
- equals <OrdT, T> (Set<OrdT, T> setA, Set<OrdT, T> setB)
- length <OrdT, T> (Set<OrdT, T> set)
- subtract <OrdT, T> (Set<OrdT, T> setA, Set<OrdT, T> setB)
- union <OrdT, T> (Set<OrdT, T> setA, Set<OrdT, T> setB)
- filter <OrdT, T> (Set<OrdT, T> set, Func<T, bool> pred)
- fold <OrdT, T, S> (Set<OrdT, T> set, S state, Func<S, T, S> folder)
- foldBack <OrdT, T, S> (Set<OrdT, T> set, S state, Func<S, T, S> folder)
- intersect <OrdT, T> (Set<OrdT, T> setA, Set<OrdT, T> setB)
- except <OrdT, T> (Set<OrdT, T> setA, Set<OrdT, T> setB)
- symmetricExcept <OrdT, T> (Set<OrdT, T> setA, Set<OrdT, T> setB)
- map <OrdT, OrdR, T, R> (Set<OrdT, T> set, Func<T, R> mapper)
- map <OrdT, T> (Set<OrdT, T> set, Func<T, T> mapper)
- contains <OrdT, T> (Set<OrdT, T> set, T value)
- remove <OrdT, T> (Set<OrdT, T> set, T value)
- isSubset <OrdT, T> (Set<OrdT, T> setA, Set<OrdT, T> setB)
- isSuperset <OrdT, T> (Set<OrdT, T> setA, Set<OrdT, T> setB)
- isProperSubset <OrdT, T> (Set<OrdT, T> setA, Set<OrdT, T> setB)
- isProperSuperset <OrdT, T> (Set<OrdT, T> setA, Set<OrdT, T> setB)
- overlaps <OrdT, T> (Set<OrdT, T> setA, Set<OrdT, T> setB)
Immutable set AVL tree implementation AVL tree is a self-balancing binary search tree. wikipedia.org/wiki/AVL_tree
type | A | Set item type |
Reference version for use in pattern-matching
Empty collection = null
Singleton collection = A
More = (A, Seq<A>) -- head and tail
var res = set.Case switch
{
(var x, var xs) => ...,
A value => ...,
_ => ...
}
method Set<A> Add (A value) Source #
Add an item to the set
param | value | Value to add to the set |
returns | New set with the item added |
method Set<A> TryAdd (A value) Source #
Attempt to add an item to the set. If an item already exists then return the Set as-is.
param | value | Value to add to the set |
returns | New set with the item maybe added |
method Set<A> AddOrUpdate (A value) Source #
Add an item to the set. If an item already exists then replace it.
param | value | Value to add to the set |
returns | New set with the item maybe added |
method Set<A> AddRange (IEnumerable<A> range) Source #
Atomically adds a range of items to the set.
Null is not allowed for a Key
param | range | Range of keys to add |
returns | New Set with the items added |
method Set<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
param | range | Range of keys to add |
returns | New Set with the items added |
method Set<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
param | range | Range of keys to add |
returns | New Set with the items added |
method Option<A> Find (A value) Source #
Attempts to find an item in the set.
param | value | Value to find |
returns | Some(T) if found, None otherwise |
method IEnumerable<A> FindRange (A keyFrom, A keyTo) Source #
Retrieve a range of values
param | keyFrom | Range start (inclusive) |
param | keyTo | Range to (inclusive) |
returns | Range of values |
method Option<A> FindPredecessor (A key) Source #
Retrieve the value from previous item to specified key
param | key | Key to find |
returns | Found key |
method Option<A> FindExactOrPredecessor (A key) Source #
Retrieve the value from exact key, or if not found, the previous item
param | key | Key to find |
returns | Found key |
method Option<A> FindSuccessor (A key) Source #
Retrieve the value from next item to specified key
param | key | Key to find |
returns | Found key |
method Option<A> FindExactOrSuccessor (A key) Source #
Retrieve the value from exact key, or if not found, the next item
param | key | Key to find |
returns | Found key |
method Set<A> Intersect (IEnumerable<A> other) Source #
Returns the elements that are in both this and other
method Set<A> Except (IEnumerable<A> other) Source #
Returns this - other. Only the items in this that are not in other will be returned.
method Set<A> Except (Set<A> other) Source #
Returns this - other. Only the items in this that are not in other will be returned.
method Set<A> SymmetricExcept (IEnumerable<A> other) Source #
Only items that are in one set or the other will be returned. If an item is in both, it is dropped.
method Set<A> SymmetricExcept (Set<A> other) Source #
Only items that are in one set or the other will be returned. If an item is in both, it is dropped.
method Set<A> Union (IEnumerable<A> other) Source #
Finds the union of two sets and produces a new set with the results
param | other | Other set to union with |
returns | A set which contains all items from both sets |
method IEnumerator<A> GetEnumerator () Source #
Get enumerator
returns | IEnumerator T |
method Set<A> Remove (A value) Source #
Removes an item from the set (if it exists)
param | value | Value to remove |
returns | New set with item removed |
method Set<A> RemoveRange (IEnumerable<A> values) Source #
Removes a range of items from the set (if they exist)
param | value | Value to remove |
returns | New set with items removed |
method S Fold <S> (S state, Func<S, A, 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)
type | S | State type |
param | state | Initial state |
param | folder | Fold function |
returns | Aggregate value |
method S FoldBack <S> (S state, Func<S, A, 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.
type | S | State type |
param | state | Initial state |
param | folder | Fold function |
returns | Aggregate value |
method Set<A> Do (Action<A> f) Source #
Impure iteration of the bound value in the structure
returns | Returns the original unmodified structure |
method Set<B> Map <B> (Func<A, B> map) Source #
Maps the values of this set into a new set of values using the mapper function to tranform the source values.
type | R | Mapped element type |
param | mapper | Mapping function |
returns | Mapped Set |
method Set<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.
param | pred | Predicate |
returns | Filtered enumerable |
method bool Exists (Func<A, bool> pred) Source #
Check the existence of an item in the set using a predicate.
Note this scans the entire set.
param | pred | Predicate |
returns | True if predicate returns true for any item |
method bool Contains (A value) Source #
Returns True if the value is in the set
param | value | Value to check |
returns | True if the item 'value' is in the Set 'set' |
method bool SetEquals (IEnumerable<A> other) Source #
Returns true if both sets contain the same elements
param | other | Other distinct set to compare |
returns | True if the sets are equal |
method bool IsProperSubsetOf (IEnumerable<A> other) Source #
Returns True if 'other' is a proper subset of this set
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
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
returns | True if 'other' is a superset of this set |
method bool IsSupersetOf (IEnumerable<A> other) Source #
Returns True if 'other' is a superset of this set
returns | True if 'other' is a superset of this set |
method bool Overlaps (IEnumerable<A> other) Source #
Returns True if other overlaps this set
type | T | Element type |
param | setA | Set A |
param | setB | Set B |
returns | True if other overlaps this set |
method void CopyTo (A[] array, int index) Source #
Copy the items from the set into the specified array
param | array | Array to copy to |
param | index | Index into the array to start |
method void CopyTo (System.Array array, int index) Source #
Copy the items from the set into the specified array
param | array | Array to copy to |
param | index | Index into the array to start |
method Set<A> Append (Set<A> rhs) Source #
Append performs a union of the two sets
param | rhs | Right hand side set |
returns | Unioned set |
method Set<A> Subtract (Set<A> rhs) Source #
Subtract operator - performs a subtract of the two sets
param | rhs | Right hand side set |
returns | Subtracted set |
method bool Equals (Set<A> other) Source #
Equality test
param | other | Other set to test |
returns | True if sets are equal |
method int GetHashCode () Source #
Get the hash code. Calculated from all items in the set.
The hash-code is cached after the first read.
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 Set<C> SelectMany <B, C> (Func<A, Set<B>> bind, Func<A, B, C> project) Source #
operator + (Set<A> lhs, Set<A> rhs) Source #
Add operator + performs a union of the two sets
param | lhs | Left hand side set |
param | rhs | Right hand side set |
returns | Unioned set |
operator - (Set<A> lhs, Set<A> rhs) Source #
Subtract operator - performs a subtract of the two sets
param | lhs | Left hand side set |
param | rhs | Right hand side set |
returns | Subtractd set |
operator == (Set<A> lhs, Set<A> rhs) Source #
Equality operator
param | lhs | Left hand side set |
param | rhs | Right hand side set |
returns | True if the two sets are equal |
class SetExtensions Source #
method TAccumulate Aggregate <TSource, TAccumulate> (this Set<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> func) Source #
Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value.
method TResult Aggregate <TSource, TAccumulate, TResult> (this Set<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> func, Func<TAccumulate, TResult> resultSelector) Source #
Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value.
method TSource Aggregate <TSource> (this Set<TSource> source, Func<TSource, TSource, TSource> func) Source #
Applies an accumulator function over a sequence.
method bool All <TSource> (this Set<TSource> source, Func<TSource, bool> predicate) Source #
Determines whether all elements of a sequence satisfy a condition.
method bool Any <TSource> (this Set<TSource> source) Source #
Determines whether a sequence contains any elements.
method bool Any <TSource> (this Set<TSource> source, Func<TSource, bool> predicate) Source #
Determines whether any element of a sequence satisfies a condition.
method IEnumerable<TSource> AsEnumerable <TSource> (this Set<TSource> source) Source #
Returns the input typed as IEnumerable
method IQueryable<TElement> AsQueryable <TElement> (this Set<TElement> source) Source #
Converts a generic IEnumerable
method decimal Average (this Set<decimal> source) Source #
Computes the average of a sequence of Decimal values.
method decimal Average <TSource> (this Set<TSource> source, Func<TSource, decimal> selector) Source #
Computes the average of a sequence of Decimal values that are obtained by invoking a transform function on each element of the input sequence.
method decimal? Average (this Set<decimal?> source) Source #
Computes the average of a sequence of nullable Decimal values.
method decimal? Average <TSource> (this Set<TSource> source, Func<TSource, decimal?> selector) Source #
Computes the average of a sequence of nullable Decimal values that are obtained by invoking a transform function on each element of the input sequence.
method double Average (this Set<double> source) Source #
Computes the average of a sequence of Double values.
method double Average (this Set<int> source) Source #
Computes the average of a sequence of Int32 values.
method double Average (this Set<long> source) Source #
Computes the average of a sequence of Int64 values.
method double Average <TSource> (this Set<TSource> source, Func<TSource, double> selector) Source #
Computes the average of a sequence of Double values that are obtained by invoking a transform function on each element of the input sequence.
method double Average <TSource> (this Set<TSource> source, Func<TSource, int> selector) Source #
Computes the average of a sequence of Int32 values that are obtained by invoking a transform function on each element of the input sequence.
method double Average <TSource> (this Set<TSource> source, Func<TSource, long> selector) Source #
Computes the average of a sequence of Int64 values that are obtained by invoking a transform function on each element of the input sequence.
method double? Average (this Set<double?> source) Source #
Computes the average of a sequence of nullable Double values.
method double? Average (this Set<int?> source) Source #
Computes the average of a sequence of nullable Int32 values.
method double? Average (this Set<long?> source) Source #
Computes the average of a sequence of nullable Int64 values.
method double? Average <TSource> (this Set<TSource> source, Func<TSource, double?> selector) Source #
Computes the average of a sequence of nullable Double values that are obtained by invoking a transform function on each element of the input sequence.
method double? Average <TSource> (this Set<TSource> source, Func<TSource, int?> selector) Source #
Computes the average of a sequence of nullable Int32 values that are obtained by invoking a transform function on each element of the input sequence.
method double? Average <TSource> (this Set<TSource> source, Func<TSource, long?> selector) Source #
Computes the average of a sequence of nullable Int64 values that are obtained by invoking a transform function on each element of the input sequence.
method float Average (this Set<float> source) Source #
Computes the average of a sequence of Single values.
method float Average <TSource> (this Set<TSource> source, Func<TSource, float> selector) Source #
Computes the average of a sequence of Single values that are obtained by invoking a transform function on each element of the input sequence.
method float? Average (this Set<float?> source) Source #
Computes the average of a sequence of nullable Single values.
method float? Average <TSource> (this Set<TSource> source, Func<TSource, float?> selector) Source #
Computes the average of a sequence of nullable Single values that are obtained by invoking a transform function on each element of the input sequence.
method IEnumerable<TSource> Concat <TSource> (this Set<TSource> first, IEnumerable<TSource> second) Source #
Concatenates two sequences.
method bool Contains <TSource> (this Set<TSource> source, TSource value) Source #
Determines whether a sequence contains a specified element by using the default equality comparer.
method bool Contains <TSource> (this Set<TSource> source, TSource value, IEqualityComparer<TSource> comparer) Source #
Determines whether a sequence contains a specified element by using a specified IEqualityComparer
method int Count <TSource> (this Set<TSource> source) Source #
Returns the number of elements in a sequence.
method int Count <TSource> (this Set<TSource> source, Func<TSource, bool> predicate) Source #
Returns a number that represents how many elements in the specified sequence satisfy a condition.
method IEnumerable<TSource> DefaultIfEmpty <TSource> (this Set<TSource> source) Source #
Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the sequence is empty.
method IEnumerable<TSource> DefaultIfEmpty <TSource> (this Set<TSource> source, TSource defaultValue) Source #
Returns the elements of the specified sequence or the specified value in a singleton collection if the sequence is empty.
method IEnumerable<TSource> Distinct <TSource> (this Set<TSource> source) Source #
Returns distinct elements from a sequence by using the default equality comparer to compare values.
method IEnumerable<TSource> Distinct <TSource> (this Set<TSource> source, IEqualityComparer<TSource> comparer) Source #
Returns distinct elements from a sequence by using a specified IEqualityComparer
method TSource ElementAt <TSource> (this Set<TSource> source, int index) Source #
Returns the element at a specified index in a sequence.
method TSource ElementAtOrDefault <TSource> (this Set<TSource> source, int index) Source #
Returns the element at a specified index in a sequence or a default value if the index is out of range.
method IEnumerable<TSource> Except <TSource> (this Set<TSource> first, IEnumerable<TSource> second) Source #
Produces the set difference of two sequences by using the default equality comparer to compare values.
method IEnumerable<TSource> Except <TSource> (this Set<TSource> first, IEnumerable<TSource> second, IEqualityComparer<TSource> comparer) Source #
Produces the set difference of two sequences by using the specified IEqualityComparer
method TSource First <TSource> (this Set<TSource> source) Source #
Returns the first element of a sequence.
method TSource First <TSource> (this Set<TSource> source, Func<TSource, bool> predicate) Source #
Returns the first element in a sequence that satisfies a specified condition.
method TSource FirstOrDefault <TSource> (this Set<TSource> source) Source #
Returns the first element of a sequence, or a default value if the sequence contains no elements.
method TSource FirstOrDefault <TSource> (this Set<TSource> source, Func<TSource, bool> predicate) Source #
Returns the first element of the sequence that satisfies a condition or a default value if no such element is found.
method IEnumerable<IGrouping<TKey, TElement>> GroupBy <TSource, TKey, TElement> (this Set<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector) Source #
Groups the elements of a sequence according to a specified key selector function and projects the elements for each group by using a specified function.
method IEnumerable<IGrouping<TKey, TElement>> GroupBy <TSource, TKey, TElement> (this Set<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer) Source #
Groups the elements of a sequence according to a key selector function. The keys are compared by using a comparer and each group's elements are projected by using a specified function.
method IEnumerable<IGrouping<TKey, TSource>> GroupBy <TSource, TKey> (this Set<TSource> source, Func<TSource, TKey> keySelector) Source #
Groups the elements of a sequence according to a specified key selector function.
method IEnumerable<IGrouping<TKey, TSource>> GroupBy <TSource, TKey> (this Set<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer) Source #
Groups the elements of a sequence according to a specified key selector function and compares the keys by using a specified comparer.
method IEnumerable<TResult> GroupBy <TSource, TKey, TElement, TResult> (this Set<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<TKey, IEnumerable<TElement>, TResult> resultSelector) Source #
Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. The elements of each group are projected by using a specified function.
method IEnumerable<TResult> GroupBy <TSource, TKey, TElement, TResult> (this Set<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<TKey, IEnumerable<TElement>, TResult> resultSelector, IEqualityComparer<TKey> comparer) Source #
Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. Key values are compared by using a specified comparer, and the elements of each group are projected by using a specified function.
method IEnumerable<TResult> GroupBy <TSource, TKey, TResult> (this Set<TSource> source, Func<TSource, TKey> keySelector, Func<TKey, IEnumerable<TSource>, TResult> resultSelector) Source #
Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key.
method IEnumerable<TResult> GroupBy <TSource, TKey, TResult> (this Set<TSource> source, Func<TSource, TKey> keySelector, Func<TKey, IEnumerable<TSource>, TResult> resultSelector, IEqualityComparer<TKey> comparer) Source #
Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. The keys are compared by using a specified comparer.
method IEnumerable<TResult> GroupJoin <TOuter, TInner, TKey, TResult> (this Set<TOuter> outer, IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, IEnumerable<TInner>, TResult> resultSelector) Source #
Correlates the elements of two sequences based on equality of keys and groups the results. The default equality comparer is used to compare keys.
method IEnumerable<TResult> GroupJoin <TOuter, TInner, TKey, TResult> (this Set<TOuter> outer, IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, IEnumerable<TInner>, TResult> resultSelector, IEqualityComparer<TKey> comparer) Source #
Correlates the elements of two sequences based on key equality and groups the results. A specified IEqualityComparer
method IEnumerable<TSource> Intersect <TSource> (this Set<TSource> first, IEnumerable<TSource> second) Source #
Produces the set intersection of two sequences by using the default equality comparer to compare values.
method IEnumerable<TSource> Intersect <TSource> (this Set<TSource> first, IEnumerable<TSource> second, IEqualityComparer<TSource> comparer) Source #
Produces the set intersection of two sequences by using the specified IEqualityComparer
method IEnumerable<TResult> Join <TOuter, TInner, TKey, TResult> (this Set<TOuter> outer, IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, TInner, TResult> resultSelector) Source #
Correlates the elements of two sequences based on matching keys. The default equality comparer is used to compare keys.
method IEnumerable<TResult> Join <TOuter, TInner, TKey, TResult> (this Set<TOuter> outer, IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, TInner, TResult> resultSelector, IEqualityComparer<TKey> comparer) Source #
Correlates the elements of two sequences based on matching keys. A specified IEqualityComparer
method TSource Last <TSource> (this Set<TSource> source) Source #
Returns the last element of a sequence.
method TSource Last <TSource> (this Set<TSource> source, Func<TSource, bool> predicate) Source #
Returns the last element of a sequence that satisfies a specified condition.
method TSource LastOrDefault <TSource> (this Set<TSource> source) Source #
Returns the last element of a sequence, or a default value if the sequence contains no elements.
method TSource LastOrDefault <TSource> (this Set<TSource> source, Func<TSource, bool> predicate) Source #
Returns the last element of a sequence that satisfies a condition or a default value if no such element is found.
method long LongCount <TSource> (this Set<TSource> source) Source #
Returns an Int64 that represents the total number of elements in a sequence.
method long LongCount <TSource> (this Set<TSource> source, Func<TSource, bool> predicate) Source #
Returns an Int64 that represents how many elements in a sequence satisfy a condition.
method decimal Max (this Set<decimal> source) Source #
Returns the maximum value in a sequence of Decimal values.
method decimal Max <TSource> (this Set<TSource> source, Func<TSource, decimal> selector) Source #
Invokes a transform function on each element of a sequence and returns the maximum Decimal value.
method decimal? Max (this Set<decimal?> source) Source #
Returns the maximum value in a sequence of nullable Decimal values.
method decimal? Max <TSource> (this Set<TSource> source, Func<TSource, decimal?> selector) Source #
Invokes a transform function on each element of a sequence and returns the maximum nullable Decimal value.
method double Max (this Set<double> source) Source #
Returns the maximum value in a sequence of Double values.
method double Max <TSource> (this Set<TSource> source, Func<TSource, double> selector) Source #
Invokes a transform function on each element of a sequence and returns the maximum Double value.
method double? Max (this Set<double?> source) Source #
Returns the maximum value in a sequence of nullable Double values.
method double? Max <TSource> (this Set<TSource> source, Func<TSource, double?> selector) Source #
Invokes a transform function on each element of a sequence and returns the maximum nullable Double value.
method float Max (this Set<float> source) Source #
Returns the maximum value in a sequence of Single values.
method float Max <TSource> (this Set<TSource> source, Func<TSource, float> selector) Source #
Invokes a transform function on each element of a sequence and returns the maximum Single value.
method float? Max (this Set<float?> source) Source #
Returns the maximum value in a sequence of nullable Single values.
method float? Max <TSource> (this Set<TSource> source, Func<TSource, float?> selector) Source #
Invokes a transform function on each element of a sequence and returns the maximum nullable Single value.
method int Max (this Set<int> source) Source #
Returns the maximum value in a sequence of Int32 values.
method int Max <TSource> (this Set<TSource> source, Func<TSource, int> selector) Source #
Invokes a transform function on each element of a sequence and returns the maximum Int32 value.
method int? Max (this Set<int?> source) Source #
Returns the maximum value in a sequence of nullable Int32 values.
method int? Max <TSource> (this Set<TSource> source, Func<TSource, int?> selector) Source #
Invokes a transform function on each element of a sequence and returns the maximum nullable Int32 value.
method long Max (this Set<long> source) Source #
Returns the maximum value in a sequence of Int64 values.
method long Max <TSource> (this Set<TSource> source, Func<TSource, long> selector) Source #
Invokes a transform function on each element of a sequence and returns the maximum Int64 value.
method long? Max (this Set<long?> source) Source #
Returns the maximum value in a sequence of nullable Int64 values.
method long? Max <TSource> (this Set<TSource> source, Func<TSource, long?> selector) Source #
Invokes a transform function on each element of a sequence and returns the maximum nullable Int64 value.
method TResult Max <TSource, TResult> (this Set<TSource> source, Func<TSource, TResult> selector) Source #
Invokes a transform function on each element of a generic sequence and returns the maximum resulting value.
method TSource Max <TSource> (this Set<TSource> source) Source #
Returns the maximum value in a generic sequence.
method decimal Min (this Set<decimal> source) Source #
Returns the minimum value in a sequence of Decimal values.
method decimal Min <TSource> (this Set<TSource> source, Func<TSource, decimal> selector) Source #
Invokes a transform function on each element of a sequence and returns the minimum Decimal value.
method decimal? Min (this Set<decimal?> source) Source #
Returns the minimum value in a sequence of nullable Decimal values.
method decimal? Min <TSource> (this Set<TSource> source, Func<TSource, decimal?> selector) Source #
Invokes a transform function on each element of a sequence and returns the minimum nullable Decimal value.
method double Min (this Set<double> source) Source #
Returns the minimum value in a sequence of Double values.
method double Min <TSource> (this Set<TSource> source, Func<TSource, double> selector) Source #
Invokes a transform function on each element of a sequence and returns the minimum Double value.
method double? Min (this Set<double?> source) Source #
Returns the minimum value in a sequence of nullable Double values.
method double? Min <TSource> (this Set<TSource> source, Func<TSource, double?> selector) Source #
Invokes a transform function on each element of a sequence and returns the minimum nullable Double value.
method float Min (this Set<float> source) Source #
Returns the minimum value in a sequence of Single values.
method float Min <TSource> (this Set<TSource> source, Func<TSource, float> selector) Source #
Invokes a transform function on each element of a sequence and returns the minimum Single value.
method float? Min (this Set<float?> source) Source #
Returns the minimum value in a sequence of nullable Single values.
method float? Min <TSource> (this Set<TSource> source, Func<TSource, float?> selector) Source #
Invokes a transform function on each element of a sequence and returns the minimum nullable Single value.
method int Min (this Set<int> source) Source #
Returns the minimum value in a sequence of Int32 values.
method int Min <TSource> (this Set<TSource> source, Func<TSource, int> selector) Source #
Invokes a transform function on each element of a sequence and returns the minimum Int32 value.
method int? Min (this Set<int?> source) Source #
Returns the minimum value in a sequence of nullable Int32 values.
method int? Min <TSource> (this Set<TSource> source, Func<TSource, int?> selector) Source #
Invokes a transform function on each element of a sequence and returns the minimum nullable Int32 value.
method long Min (this Set<long> source) Source #
Returns the minimum value in a sequence of Int64 values.
method long Min <TSource> (this Set<TSource> source, Func<TSource, long> selector) Source #
Invokes a transform function on each element of a sequence and returns the minimum Int64 value.
method long? Min (this Set<long?> source) Source #
Returns the minimum value in a sequence of nullable Int64 values.
method long? Min <TSource> (this Set<TSource> source, Func<TSource, long?> selector) Source #
Invokes a transform function on each element of a sequence and returns the minimum nullable Int64 value.
method TResult Min <TSource, TResult> (this Set<TSource> source, Func<TSource, TResult> selector) Source #
Invokes a transform function on each element of a generic sequence and returns the minimum resulting value.
method TSource Min <TSource> (this Set<TSource> source) Source #
Returns the minimum value in a generic sequence.
method IOrderedEnumerable<TSource> OrderBy <TSource, TKey> (this Set<TSource> source, Func<TSource, TKey> keySelector) Source #
Sorts the elements of a sequence in ascending order according to a key.
method IOrderedEnumerable<TSource> OrderBy <TSource, TKey> (this Set<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer) Source #
Sorts the elements of a sequence in ascending order by using a specified comparer.
method IOrderedEnumerable<TSource> OrderByDescending <TSource, TKey> (this Set<TSource> source, Func<TSource, TKey> keySelector) Source #
Sorts the elements of a sequence in descending order according to a key.
method IOrderedEnumerable<TSource> OrderByDescending <TSource, TKey> (this Set<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer) Source #
Sorts the elements of a sequence in descending order by using a specified comparer.
method IEnumerable<TSource> Reverse <TSource> (this Set<TSource> source) Source #
Inverts the order of the elements in a sequence.
method bool SequenceEqual <TSource> (this Set<TSource> first, IEnumerable<TSource> second) Source #
Determines whether two sequences are equal by comparing the elements by using the default equality comparer for their type.
method bool SequenceEqual <TSource> (this Set<TSource> first, IEnumerable<TSource> second, IEqualityComparer<TSource> comparer) Source #
Determines whether two sequences are equal by comparing their elements by using a specified IEqualityComparer
method TSource Single <TSource> (this Set<TSource> source) Source #
Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence.
method TSource Single <TSource> (this Set<TSource> source, Func<TSource, bool> predicate) Source #
Returns the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists.
method TSource SingleOrDefault <TSource> (this Set<TSource> source) Source #
Returns the only element of a sequence, or a default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence.
method TSource SingleOrDefault <TSource> (this Set<TSource> source, Func<TSource, bool> predicate) Source #
Returns the only element of a sequence that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition.
method IEnumerable<TSource> Skip <TSource> (this Set<TSource> source, int count) Source #
Bypasses a specified number of elements in a sequence and then returns the remaining elements.
method IEnumerable<TSource> SkipWhile <TSource> (this Set<TSource> source, Func<TSource, bool> predicate) Source #
Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.
method IEnumerable<TSource> SkipWhile <TSource> (this Set<TSource> source, Func<TSource, int, bool> predicate) Source #
Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements. The element's index is used in the logic of the predicate function.
method decimal Sum (this Set<decimal> source) Source #
Computes the sum of a sequence of Decimal values.
method decimal Sum <TSource> (this Set<TSource> source, Func<TSource, decimal> selector) Source #
Computes the sum of the sequence of Decimal values that are obtained by invoking a transform function on each element of the input sequence.
method decimal? Sum (this Set<decimal?> source) Source #
Computes the sum of a sequence of nullable Decimal values.
method decimal? Sum <TSource> (this Set<TSource> source, Func<TSource, decimal?> selector) Source #
Computes the sum of the sequence of nullable Decimal values that are obtained by invoking a transform function on each element of the input sequence.
method double Sum (this Set<double> source) Source #
Computes the sum of a sequence of Double values.
method double Sum <TSource> (this Set<TSource> source, Func<TSource, double> selector) Source #
Computes the sum of the sequence of Double values that are obtained by invoking a transform function on each element of the input sequence.
method double? Sum (this Set<double?> source) Source #
Computes the sum of a sequence of nullable Double values.
method double? Sum <TSource> (this Set<TSource> source, Func<TSource, double?> selector) Source #
Computes the sum of the sequence of nullable Double values that are obtained by invoking a transform function on each element of the input sequence.
method float Sum <TSource> (this Set<TSource> source, Func<TSource, float> selector) Source #
Computes the sum of the sequence of Single values that are obtained by invoking a transform function on each element of the input sequence.
method float? Sum (this Set<float?> source) Source #
Computes the sum of a sequence of nullable Single values.
method float? Sum <TSource> (this Set<TSource> source, Func<TSource, float?> selector) Source #
Computes the sum of the sequence of nullable Single values that are obtained by invoking a transform function on each element of the input sequence.
method int Sum <TSource> (this Set<TSource> source, Func<TSource, int> selector) Source #
Computes the sum of the sequence of Int32 values that are obtained by invoking a transform function on each element of the input sequence.
method int? Sum (this Set<int?> source) Source #
Computes the sum of a sequence of nullable Int32 values.
method int? Sum <TSource> (this Set<TSource> source, Func<TSource, int?> selector) Source #
Computes the sum of the sequence of nullable Int32 values that are obtained by invoking a transform function on each element of the input sequence.
method long Sum <TSource> (this Set<TSource> source, Func<TSource, long> selector) Source #
Computes the sum of the sequence of Int64 values that are obtained by invoking a transform function on each element of the input sequence.
method long? Sum (this Set<long?> source) Source #
Computes the sum of a sequence of nullable Int64 values.
method long? Sum <TSource> (this Set<TSource> source, Func<TSource, long?> selector) Source #
Computes the sum of the sequence of nullable Int64 values that are obtained by invoking a transform function on each element of the input sequence.
method IEnumerable<TSource> Take <TSource> (this Set<TSource> source, int count) Source #
Returns a specified number of contiguous elements from the start of a sequence.
method IEnumerable<TSource> TakeWhile <TSource> (this Set<TSource> source, Func<TSource, bool> predicate) Source #
Returns elements from a sequence as long as a specified condition is true.
method IEnumerable<TSource> TakeWhile <TSource> (this Set<TSource> source, Func<TSource, int, bool> predicate) Source #
Returns elements from a sequence as long as a specified condition is true. The element's index is used in the logic of the predicate function.
method TSource[] ToArray <TSource> (this Set<TSource> source) Source #
Creates an array from a IEnumerable
method Dictionary<TKey, TElement> ToDictionary <TSource, TKey, TElement> (this Set<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector) Source #
Creates a Dictionary<TKey,TValue> from an IEnumerable
method Dictionary<TKey, TElement> ToDictionary <TSource, TKey, TElement> (this Set<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer) Source #
Creates a Dictionary<TKey,TValue> from an IEnumerable
method Dictionary<TKey, TSource> ToDictionary <TSource, TKey> (this Set<TSource> source, Func<TSource, TKey> keySelector) Source #
Creates a Dictionary<TKey,TValue> from an IEnumerable
method Dictionary<TKey, TSource> ToDictionary <TSource, TKey> (this Set<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer) Source #
Creates a Dictionary<TKey,TValue> from an IEnumerable
method List<TSource> ToList <TSource> (this Set<TSource> source) Source #
Creates a List
method ILookup<TKey, TElement> ToLookup <TSource, TKey, TElement> (this Set<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector) Source #
Creates a Lookup<TKey,TElement> from an IEnumerable
method ILookup<TKey, TElement> ToLookup <TSource, TKey, TElement> (this Set<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer) Source #
Creates a Lookup<TKey,TElement> from an IEnumerable
method ILookup<TKey, TSource> ToLookup <TSource, TKey> (this Set<TSource> source, Func<TSource, TKey> keySelector) Source #
Creates a Lookup<TKey,TElement> from an IEnumerable
method ILookup<TKey, TSource> ToLookup <TSource, TKey> (this Set<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer) Source #
Creates a Lookup<TKey,TElement> from an IEnumerable
method IEnumerable<TSource> Union <TSource> (this Set<TSource> first, IEnumerable<TSource> second) Source #
Produces the set union of two sequences by using the default equality comparer.
class SetEnumerator <K> Source #
constructor SetEnumerator (SetItem<K> root, bool rev, int start) Source #
Immutable set module AVL tree implementation AVL tree is a self-balancing binary search tree. http://en.wikipedia.org/wiki/AVL_tree
method bool isEmpty <T> (Set<T> set) Source #
True if the set has no elements
type | T | Element type |
returns | True if the set has no elements |
method Set<T> createRange <T> (IEnumerable<T> range) Source #
Create a new set pre-populated with the items in range
type | T | Element type |
param | range | Range of items |
returns | Set |
method Set<T> add <T> (Set<T> set, T value) Source #
Add an item to the set
type | T | Element type |
param | set | Set to add item to |
param | value | Value to add to the set |
returns | New set with the item added |
method Set<T> tryAdd <T> (Set<T> set, T value) Source #
Attempt to add an item to the set. If an item already exists then return the Set as-is.
type | T | Element type |
param | set | Set to add item to |
param | value | Value to add to the set |
returns | New set with the item maybe added |
method Set<T> addOrUpdate <T> (Set<T> set, T value) Source #
Add an item to the set. If an item already exists then replace it.
type | T | Element type |
param | set | Set to add item to |
param | value | Value to add to the set |
returns | New set with the item maybe added |
method Set<A> addRange <A> (Set<A> set, IEnumerable<A> range) Source #
Atomically adds a range of items to the set.
Null is not allowed for a Key
param | range | Range of keys to add |
returns | New Set with the items added |
method Set<A> tryAddRange <A> (Set<A> set, 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
param | range | Range of keys to add |
returns | New Set with the items added |
method Set<A> addOrUpdateRange <A> (Set<A> set, 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
param | range | Range of keys to add |
returns | New Set with the items added |
method Option<T> find <T> (Set<T> set, T value) Source #
Attempts to find an item in the set.
type | T | Element type |
param | set | Set |
param | value | Value to find |
returns | Some(T) if found, None otherwise |
method bool exists <T> (Set<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.
type | T | Element type |
param | set | Set |
param | pred | Predicate |
returns | True if predicate returns true for any item |
method bool equals <T> (Set<T> setA, Set<T> setB) Source #
Returns true if both sets contain the same elements
method int length <T> (Set<T> set) Source #
Get the number of elements in the set
type | T | Element type |
param | set | Set |
returns | Number of elements |
method Set<T> subtract <T> (Set<T> setA, Set<T> setB) Source #
Returns setA - setB. Only the items in setA that are not in setB will be returned.
method Set<T> union <T> (Set<T> setA, Set<T> setB) Source #
Finds the union of two sets and produces a new set with the results
type | T | Element type |
param | setA | Set A |
param | setB | Set A |
returns | A set which contains all items from both sets |
method Set<T> filter <T> (Set<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.
type | T | Element type |
param | set | Set |
param | pred | Predicate |
returns | Filtered enumerable |
method S fold <T, S> (Set<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)
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> (Set<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.
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 Set<T> intersect <T> (Set<T> setA, IEnumerable<T> setB) Source #
Returns the elements that are in both setA and setB
method Set<T> except <T> (Set<T> setA, IEnumerable<T> setB) Source #
Returns this - other. Only the items in this that are not in other will be returned.
method Set<T> symmetricExcept <T> (Set<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 Set<R> map <T, R> (Set<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.
type | T | Element type |
type | R | Mapped element type |
param | set | Set |
param | mapper | Mapping function |
returns | Mapped enumerable |
method bool contains <T> (Set<T> set, T value) Source #
Returns True if the value is in the set
type | T | Element type |
param | set | Set |
param | value | Value to check |
returns | True if the item 'value' is in the Set 'set' |
method Set<T> remove <T> (Set<T> set, T value) Source #
Removes an item from the set (if it exists)
type | T | Element type |
param | set | Set |
param | value | Value to check |
returns | New set with item removed |
method bool isSubset <T> (Set<T> setA, IEnumerable<T> setB) Source #
Returns True if setB is a subset of setA
type | T | Element type |
param | setA | Set A |
param | setB | Set B |
returns | True is setB is a subset of setA |
method bool isSuperset <T> (Set<T> setA, IEnumerable<T> setB) Source #
Returns True if setB is a superset of setA
type | T | Element type |
param | setA | Set A |
param | setB | Set B |
returns | True is setB is a superset of setA |
method bool isProperSubset <T> (Set<T> setA, IEnumerable<T> setB) Source #
Returns True if setB is a proper subset of setA
type | T | Element type |
param | setA | Set A |
param | setB | Set B |
returns | True is setB is a proper subset of setA |
method bool isProperSuperset <T> (Set<T> setA, IEnumerable<T> setB) Source #
Returns True if setB is a proper superset of setA
type | T | Element type |
param | setA | Set A |
param | setB | Set B |
returns | True is setB is a proper subset of setA |
Immutable set AVL tree implementation AVL tree is a self-balancing binary search tree. wikipedia.org/wiki/AVL_tree
type | A | Set item type |
field Set<OrdA, A> Empty = new Set<OrdA, A>(SetInternal<OrdA, A>.Empty) Source #
Reference version for use in pattern-matching
Empty collection = null
Singleton collection = A
More = (A, Seq<A>) -- head and tail
var res = set.Case switch
{
(var x, var xs) => ...,
A value => ...,
_ => ...
}
method Set<OrdA, A> Add (A value) Source #
Add an item to the set
param | value | Value to add to the set |
returns | New set with the item added |
method Set<OrdA, A> TryAdd (A value) Source #
Attempt to add an item to the set. If an item already exists then return the Set as-is.
param | value | Value to add to the set |
returns | New set with the item maybe added |
method Set<OrdA, A> AddOrUpdate (A value) Source #
Add an item to the set. If an item already exists then replace it.
param | value | Value to add to the set |
returns | New set with the item maybe added |
method Set<OrdA, A> AddRange (IEnumerable<A> range) Source #
Atomically adds a range of items to the set.
Null is not allowed for a Key
param | range | Range of keys to add |
returns | New Set with the items added |
method Set<OrdA, 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
param | range | Range of keys to add |
returns | New Set with the items added |
method Set<OrdA, 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
param | range | Range of keys to add |
returns | New Set with the items added |
method Option<A> Find (A value) Source #
Attempts to find an item in the set.
param | value | Value to find |
returns | Some(T) if found, None otherwise |
method Option<A> FindPredecessor (A key) Source #
Retrieve the value from previous item to specified key
param | key | Key to find |
returns | Found key |
method Option<A> FindExactOrPredecessor (A key) Source #
Retrieve the value from exact key, or if not found, the previous item
param | key | Key to find |
returns | Found key |
method Option<A> FindSuccessor (A key) Source #
Retrieve the value from next item to specified key
param | key | Key to find |
returns | Found key |
method Option<A> FindExactOrSuccessor (A key) Source #
Retrieve the value from exact key, or if not found, the next item
param | key | Key to find |
returns | Found key |
method IEnumerable<A> FindRange (A keyFrom, A keyTo) Source #
Retrieve a range of values
param | keyFrom | Range start (inclusive) |
param | keyTo | Range to (inclusive) |
returns | Range of values |
method Set<OrdA, A> Intersect (Set<OrdA, A> other) Source #
Returns the elements that are in both this and other
method Set<OrdA, A> Except (Set<OrdA, A> other) Source #
Returns this - other. Only the items in this that are not in other will be returned.
method Set<OrdA, A> Except (IEnumerable<A> other) Source #
Returns this - other. Only the items in this that are not in other will be returned.
method Set<OrdA, A> SymmetricExcept (Set<OrdA, A> other) Source #
Only items that are in one set or the other will be returned. If an item is in both, it is dropped.
method Set<OrdA, A> SymmetricExcept (IEnumerable<A> other) Source #
Only items that are in one set or the other will be returned. If an item is in both, it is dropped.
method Set<OrdA, A> Union (Set<OrdA, A> other) Source #
Finds the union of two sets and produces a new set with the results
param | other | Other set to union with |
returns | A set which contains all items from both sets |
method IEnumerator<A> GetEnumerator () Source #
Get enumerator
returns | IEnumerator T |
method Set<OrdA, A> Remove (A value) Source #
Removes an item from the set (if it exists)
param | value | Value to check |
returns | New set with item removed |
method S Fold <S> (S state, Func<S, A, 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)
type | S | State type |
param | state | Initial state |
param | folder | Fold function |
returns | Aggregate value |
method S FoldBack <S> (S state, Func<S, A, 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.
type | S | State type |
param | state | Initial state |
param | folder | Fold function |
returns | Aggregate value |
method Set<OrdA, A> Do (Action<A> f) Source #
Impure iteration of the bound values in the structure
returns | Returns the original unmodified structure |
method Set<OrdB, B> Map <OrdB, B> (Func<A, B> map) Source #
Maps the values of this set into a new set of values using the mapper function to tranform the source values.
type | R | Mapped element type |
param | mapper | Mapping function |
returns | Mapped Set |
method Set<OrdA, A> Map (Func<A, A> map) Source #
Maps the values of this set into a new set of values using the mapper function to tranform the source values.
type | R | Mapped element type |
param | mapper | Mapping function |
returns | Mapped Set |
method Set<OrdA, 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.
param | pred | Predicate |
returns | Filtered enumerable |
method bool Exists (Func<A, bool> pred) Source #
Check the existence of an item in the set using a predicate.
Note this scans the entire set.
param | pred | Predicate |
returns | True if predicate returns true for any item |
method bool Contains (A value) Source #
Returns True if the value is in the set
param | value | Value to check |
returns | True if the item 'value' is in the Set 'set' |
method bool SetEquals (Set<OrdA, A> other) Source #
Returns true if both sets contain the same elements
param | other | Other distinct set to compare |
returns | True if the sets are equal |
method bool IsProperSubsetOf (Set<OrdA, A> other) Source #
Returns True if 'other' is a proper subset of this set
returns | True if 'other' is a proper subset of this set |
method bool IsProperSupersetOf (Set<OrdA, A> other) Source #
Returns True if 'other' is a proper superset of this set
returns | True if 'other' is a proper superset of this set |
method bool IsSubsetOf (Set<OrdA, A> other) Source #
Returns True if 'other' is a superset of this set
returns | True if 'other' is a superset of this set |
method bool IsSupersetOf (Set<OrdA, A> other) Source #
Returns True if 'other' is a superset of this set
returns | True if 'other' is a superset of this set |
method bool Overlaps (Set<OrdA, A> other) Source #
Returns True if other overlaps this set
type | T | Element type |
param | setA | Set A |
param | setB | Set B |
returns | True if other overlaps this set |
method void CopyTo (A[] array, int index) Source #
Copy the items from the set into the specified array
param | array | Array to copy to |
param | index | Index into the array to start |
method void CopyTo (System.Array array, int index) Source #
Copy the items from the set into the specified array
param | array | Array to copy to |
param | index | Index into the array to start |
method Set<OrdA, A> Append (Set<OrdA, A> rhs) Source #
Add operator - performs a union of the two sets
param | rhs | Right hand side set |
returns | Unioned set |
method Set<OrdA, A> Subtract (Set<OrdA, A> rhs) Source #
Subtract operator - performs a subtract of the two sets
param | rhs | Right hand side set |
returns | Subtracted set |
method bool Equals (Set<OrdA, A> other) Source #
Equality test
param | other | Other set to test |
returns | True if sets are equal |
method int GetHashCode () Source #
Get the hash code. Calculated from all items in the set.
The hash-code is cached after the first read.
method IEnumerable<A> AsEnumerable () Source #
operator + (Set<OrdA, A> lhs, Set<OrdA, A> rhs) Source #
Add operator - performs a union of the two sets
param | lhs | Left hand side set |
param | rhs | Right hand side set |
returns | Unioned set |
operator - (Set<OrdA, A> lhs, Set<OrdA, A> rhs) Source #
Subtract operator - performs a subtract of the two sets
param | lhs | Left hand side set |
param | rhs | Right hand side set |
returns | Subtractd set |
operator == (Set<OrdA, A> lhs, Set<OrdA, A> rhs) Source #
Equality operator
param | lhs | Left hand side set |
param | rhs | Right hand side set |
returns | True if the two sets are equal |
Immutable set module AVL tree implementation AVL tree is a self-balancing binary search tree. http://en.wikipedia.org/wiki/AVL_tree
method bool isEmpty <OrdT, T> (Set<OrdT, T> set) Source #
True if the set has no elements
type | T | Element type |
returns | True if the set has no elements |
method Set<OrdT, T> create <OrdT, T> () Source #
Create a new empty set
type | T | Element type |
returns | Empty set |
method Set<OrdT, T> createRange <OrdT, T> (IEnumerable<T> range) Source #
Create a new set pre-populated with the items in range
type | T | Element type |
param | range | Range of items |
returns | Set |
method Set<OrdT, T> empty <OrdT, T> () Source #
Create a new empty set
type | T | Element type |
returns | Empty set |
method Set<OrdT, T> add <OrdT, T> (Set<OrdT, T> set, T value) Source #
Add an item to the set
type | T | Element type |
param | set | Set to add item to |
param | value | Value to add to the set |
returns | New set with the item added |
method Set<OrdT, T> tryAdd <OrdT, T> (Set<OrdT, T> set, T value) Source #
Attempt to add an item to the set. If an item already exists then return the Set as-is.
type | T | Element type |
param | set | Set to add item to |
param | value | Value to add to the set |
returns | New set with the item maybe added |
method Set<OrdT, T> addOrUpdate <OrdT, T> (Set<OrdT, T> set, T value) Source #
Add an item to the set. If an item already exists then replace it.
type | T | Element type |
param | set | Set to add item to |
param | value | Value to add to the set |
returns | New set with the item maybe added |
method Set<OrdT, T> addRange <OrdT, T> (Set<OrdT, T> set, IEnumerable<T> range) Source #
Atomically adds a range of items to the set.
Null is not allowed for a Key
param | range | Range of keys to add |
returns | New Set with the items added |
method Set<OrdT, T> tryAddRange <OrdT, T> (Set<OrdT, T> set, IEnumerable<T> 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
param | range | Range of keys to add |
returns | New Set with the items added |
method Set<OrdT, T> addOrUpdateRange <OrdT, T> (Set<OrdT, T> set, IEnumerable<T> 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
param | range | Range of keys to add |
returns | New Set with the items added |
method Option<T> find <OrdT, T> (Set<OrdT, T> set, T value) Source #
Attempts to find an item in the set.
type | T | Element type |
param | set | Set |
param | value | Value to find |
returns | Some(T) if found, None otherwise |
method bool exists <OrdT, T> (Set<OrdT, 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.
type | T | Element type |
param | set | Set |
param | pred | Predicate |
returns | True if predicate returns true for any item |
method bool equals <OrdT, T> (Set<OrdT, T> setA, Set<OrdT, T> setB) Source #
Returns true if both sets contain the same elements
method int length <OrdT, T> (Set<OrdT, T> set) Source #
Get the number of elements in the set
type | T | Element type |
param | set | Set |
returns | Number of elements |
method Set<OrdT, T> subtract <OrdT, T> (Set<OrdT, T> setA, Set<OrdT, T> setB) Source #
Returns setA - setB. Only the items in setA that are not in setB will be returned.
method Set<OrdT, T> union <OrdT, T> (Set<OrdT, T> setA, Set<OrdT, T> setB) Source #
Finds the union of two sets and produces a new set with the results
type | T | Element type |
param | setA | Set A |
param | setB | Set A |
returns | A set which contains all items from both sets |
method Set<OrdT, T> filter <OrdT, T> (Set<OrdT, 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.
type | T | Element type |
param | set | Set |
param | pred | Predicate |
returns | Filtered enumerable |
method S fold <OrdT, T, S> (Set<OrdT, 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)
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 <OrdT, T, S> (Set<OrdT, 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.
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 Set<OrdT, T> intersect <OrdT, T> (Set<OrdT, T> setA, Set<OrdT, T> setB) Source #
Returns the elements that are in both setA and setB
method Set<OrdT, T> except <OrdT, T> (Set<OrdT, T> setA, Set<OrdT, T> setB) Source #
Returns this - other. Only the items in this that are not in other will be returned.
method Set<OrdT, T> symmetricExcept <OrdT, T> (Set<OrdT, T> setA, Set<OrdT, 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 Set<OrdR, R> map <OrdT, OrdR, T, R> (Set<OrdT, 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.
type | T | Element type |
type | R | Mapped element type |
param | set | Set |
param | mapper | Mapping function |
returns | Mapped enumerable |
method Set<OrdT, T> map <OrdT, T> (Set<OrdT, T> set, Func<T, T> mapper) Source #
Maps the values of this set into a new set of values using the mapper function to tranform the source values.
type | T | Element type |
type | R | Mapped element type |
param | set | Set |
param | mapper | Mapping function |
returns | Mapped enumerable |
method bool contains <OrdT, T> (Set<OrdT, T> set, T value) Source #
Returns True if the value is in the set
type | T | Element type |
param | set | Set |
param | value | Value to check |
returns | True if the item 'value' is in the Set 'set' |
method Set<OrdT, T> remove <OrdT, T> (Set<OrdT, T> set, T value) Source #
Removes an item from the set (if it exists)
type | T | Element type |
param | set | Set |
param | value | Value to check |
returns | New set with item removed |
method bool isSubset <OrdT, T> (Set<OrdT, T> setA, Set<OrdT, T> setB) Source #
Returns True if setB is a subset of setA
type | T | Element type |
param | setA | Set A |
param | setB | Set B |
returns | True is setB is a subset of setA |
method bool isSuperset <OrdT, T> (Set<OrdT, T> setA, Set<OrdT, T> setB) Source #
Returns True if setB is a superset of setA
type | T | Element type |
param | setA | Set A |
param | setB | Set B |
returns | True is setB is a superset of setA |
method bool isProperSubset <OrdT, T> (Set<OrdT, T> setA, Set<OrdT, T> setB) Source #
Returns True if setB is a proper subset of setA
type | T | Element type |
param | setA | Set A |
param | setB | Set B |
returns | True is setB is a proper subset of setA |
method bool isProperSuperset <OrdT, T> (Set<OrdT, T> setA, Set<OrdT, T> setB) Source #
Returns True if setB is a proper superset of setA
type | T | Element type |
param | setA | Set A |
param | setB | Set B |
returns | True is setB is a proper subset of setA |