- Set <A>
- Empty
- Set (IEnumerable<A> items)
- Set (ReadOnlySpan<A> items)
- Set (IEnumerable<A> items, bool tryAdd)
- Set (ReadOnlySpan<A> items, bool tryAdd)
- item (A key)
- map (Lens<A, A> lens)
- Case
- AsStream <M> ()
- 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)
- Do (Action<A> f)
- Map <B> (Func<A, B> map)
- Traverse <F, B> (Func<A, K<F, B>> f)
- TraverseM <M, B> (Func<A, K<M, B>> f)
- 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 (Array array, int index)
- + (Set<A> lhs, Set<A> rhs)
- | (Set<A> x, K<Set, A> y)
- | (K<Set, A> x, Set<A> y)
- Combine (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
- AdditiveIdentity
- SetExtensions
- SetExtensions
- Map <A, B> (this Func<A, B> f, K<Set, A> ma)
- Map <A, B> (this Func<A, B> f, Set<A> ma)
- Action <A, B> (this Set<A> ma, Set<B> mb)
- Action <A, B> (this K<Set, A> ma, K<Set, B> mb)
- Apply <A, B> (this Set<Func<A, B>> mf, K<Set, A> ma)
- Apply <A, B> (this K<Set, Func<A, B>> mf, K<Set, A> ma)
- AddOpt
- SetEnumerator <K>
- Set
- isEmpty <T> (Set<T> set)
- singleton <A> (A value)
- create <T> ()
- createRange <T> (IEnumerable<T> range)
- createRange <A> (ReadOnlySpan<A> 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
- Set <OrdA, A>
- Empty = new (SetInternal<OrdA, A>.Empty)
- Set (IEnumerable<A> items)
- Set (ReadOnlySpan<A> items)
- Set (IEnumerable<A> items, bool tryAdd)
- Set (ReadOnlySpan<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 (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)
- singleton <OrdA, A> (A value)
- create <OrdT, T> ()
- createRange <OrdT, T> (IEnumerable<T> range)
- createRange <OrdA, A> (ReadOnlySpan<A> 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)
- Prelude
Immutable set AVL tree implementation AVL tree is a self-balancing binary search tree. wikipedia.org/wiki/AVL_tree
type | A | Set item type |
property object? Case 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 => ...,
_ => ...
}
property Set<A> AdditiveIdentity Source #
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 Iterable<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 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 K<F, Set<B>> Traverse <F, B> (Func<A, K<F, B>> f) Source #
Map each element of a structure to an action, evaluate these actions from left to right, and collect the results.
type | F | Applicative functor trait |
type | B | Bound value (output) |
param | f | |
param | ta | Traversable structure |
method K<M, Set<B>> TraverseM <M, B> (Func<A, K<M, B>> f) Source #
Map each element of a structure to an action, evaluate these actions from left to right, and collect the results.
type | M | Monad trait |
type | B | Bound value (output) |
param | f | |
param | ta | Traversable structure |
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 (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> Combine (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 ellipsis 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 Iterable<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 #
class SetExtensions Source #
method Set<B> Map <A, B> (this Func<A, B> f, K<Set, A> ma) Source #
Functor map operation
Unwraps the value within the functor, passes it to the map function f
provided, and
then takes the mapped value and wraps it back up into a new functor.
param | ma | Functor to map |
param | f | Mapping function |
returns | Mapped functor |
method Set<B> Map <A, B> (this Func<A, B> f, Set<A> ma) Source #
Functor map operation
Unwraps the value within the functor, passes it to the map function f
provided, and
then takes the mapped value and wraps it back up into a new functor.
param | ma | Functor to map |
param | f | Mapping function |
returns | Mapped functor |
method Set<B> Action <A, B> (this Set<A> ma, Set<B> mb) Source #
Applicative action: runs the first applicative, ignores the result, and returns the second applicative
method Set<B> Action <A, B> (this K<Set, A> ma, K<Set, B> mb) Source #
Applicative action: runs the first applicative, ignores the result, and returns the second applicative
method Set<B> Apply <A, B> (this Set<Func<A, B>> mf, K<Set, A> ma) Source #
Applicative functor apply operation
Unwraps the value within the ma
applicative-functor, passes it to the unwrapped function(s) within mf
, and
then takes the resulting value and wraps it back up into a new applicative-functor.
param | ma | Value(s) applicative functor |
param | mf | Mapping function(s) |
returns | Mapped applicative functor |
method Set<B> Apply <A, B> (this K<Set, Func<A, B>> mf, K<Set, A> ma) Source #
Applicative functor apply operation
Unwraps the value within the ma
applicative-functor, passes it to the unwrapped function(s) within mf
, and
then takes the resulting value and wraps it back up into a new applicative-functor.
param | ma | Value(s) applicative functor |
param | mf | Mapping function(s) |
returns | Mapped applicative functor |
class SetEnumerator <K> Source #
constructor SetEnumerator (SetItem<K> root, bool rev, int start) Source #
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<A> createRange <A> (ReadOnlySpan<A> 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 (SetInternal<OrdA, A>.Empty) Source #
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 Iterable<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 (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 Iterable<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 | Subtracted 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<OrdA, A> singleton <OrdA, A> (A value) Source #
Create a new single item set
type | A | Element type |
returns | Singleton set |
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<OrdA, A> createRange <OrdA, A> (ReadOnlySpan<A> 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 |
method Set<B> map <A, B> (Func<A, B> f, K<Set, A> ma) Source #
Functor map operation
Unwraps the value within the functor, passes it to the map function f
provided, and
then takes the mapped value and wraps it back up into a new functor.
param | ma | Functor to map |
param | f | Mapping function |
returns | Mapped functor |
method Set<B> action <A, B> (K<Set, A> ma, K<Set, B> mb) Source #
Applicative action: runs the first applicative, ignores the result, and returns the second applicative
method Set<B> apply <A, B> (K<Set, Func<A, B>> mf, K<Set, A> ma) Source #
Applicative functor apply operation
Unwraps the value within the ma
applicative-functor, passes it to the unwrapped function(s) within mf
, and
then takes the resulting value and wraps it back up into a new applicative-functor.
param | ma | Value(s) applicative functor |
param | mf | Mapping function(s) |
returns | Mapped applicative functor |