FSharpPlus


NonEmptySet Module

Basic operations on NonEmptySet

Functions and values

Function or value Description

NonEmptySet.add value source

Full Usage: NonEmptySet.add value source

Parameters:
    value : 'a - The value to add.
    source : NonEmptySet<'a> - The input set.

Returns: NonEmptySet<'a> A new set containing value.

Returns a new set with an element added to the set. No exception is raised if the set already contains the given element.

value : 'a

The value to add.

source : NonEmptySet<'a>

The input set.

Returns: NonEmptySet<'a>

A new set containing value.

NonEmptySet.contains element source

Full Usage: NonEmptySet.contains element source

Parameters:
    element : 'a - The element to test.
    source : NonEmptySet<'a> - The input set.

Returns: bool True if element is in set.

Evaluates to "true" if the given element is in the given set.

element : 'a

The element to test.

source : NonEmptySet<'a>

The input set.

Returns: bool

True if element is in set.

NonEmptySet.count nes

Full Usage: NonEmptySet.count nes

Parameters:
Returns: int

Returns the count of a non empty set. You can also use property nes.Count

nes : NonEmptySet<'a>
Returns: int

NonEmptySet.create x xs

Full Usage: NonEmptySet.create x xs

Parameters:
    x : 'a
    xs : seq<'a>

Returns: NonEmptySet<'a>

Builds a non empty set.

x : 'a
xs : seq<'a>
Returns: NonEmptySet<'a>

NonEmptySet.exists predicate set

Full Usage: NonEmptySet.exists predicate set

Parameters:
    predicate : 'a -> bool - The function to test set elements.
    set : NonEmptySet<'a> - The input set.

Returns: bool True if any element of set satisfies predicate.

Tests if any element of the collection satisfies the given predicate. If the input function is predicate and the elements are i0...iN then computes p i0 or ... or p iN.

predicate : 'a -> bool

The function to test set elements.

set : NonEmptySet<'a>

The input set.

Returns: bool

True if any element of set satisfies predicate.

NonEmptySet.fold folder state set

Full Usage: NonEmptySet.fold folder state set

Parameters:
    folder : 'a -> 'b -> 'a - The accumulating function.
    state : 'a - The initial state.
    set : NonEmptySet<'b> - The input set.

Returns: 'a The final state.

Applies the given accumulating function to all the elements of the set

folder : 'a -> 'b -> 'a

The accumulating function.

state : 'a

The initial state.

set : NonEmptySet<'b>

The input set.

Returns: 'a

The final state.

NonEmptySet.foldBack folder set state

Full Usage: NonEmptySet.foldBack folder set state

Parameters:
    folder : 'a -> 'b -> 'b - The accumulating function.
    set : NonEmptySet<'a> - The input set.
    state : 'b - The initial state.

Returns: 'b The final state.

Applies the given accumulating function to all the elements of the set.

folder : 'a -> 'b -> 'b

The accumulating function.

set : NonEmptySet<'a>

The input set.

state : 'b

The initial state.

Returns: 'b

The final state.

NonEmptySet.forall predicate set

Full Usage: NonEmptySet.forall predicate set

Parameters:
    predicate : 'a -> bool - The function to test set elements.
    set : NonEmptySet<'a> - The input set.

Returns: bool True if all elements of set satisfy predicate.

Tests if all elements of the collection satisfy the given predicate. If the input function is f and the elements are i0...iN and "j0...jN" then computes p i0 && ... && p iN.

predicate : 'a -> bool

The function to test set elements.

set : NonEmptySet<'a>

The input set.

Returns: bool

True if all elements of set satisfy predicate.

NonEmptySet.isProperSubset set1 set2

Full Usage: NonEmptySet.isProperSubset set1 set2

Parameters:
Returns: bool True if set1 is a proper subset of set2.

Evaluates to "true" if all elements of the first set are in the second, and at least one element of the second is not in the first.

set1 : NonEmptySet<'a>

The potential subset.

set2 : NonEmptySet<'a>

The set to test against.

Returns: bool

True if set1 is a proper subset of set2.

NonEmptySet.isProperSuperset set1 set2

Full Usage: NonEmptySet.isProperSuperset set1 set2

Parameters:
Returns: bool True if set1 is a proper superset of set2.

Evaluates to "true" if all elements of the second set are in the first, and at least one element of the first is not in the second.

set1 : NonEmptySet<'a>

The potential superset.

set2 : NonEmptySet<'a>

The set to test against.

Returns: bool

True if set1 is a proper superset of set2.

NonEmptySet.isSubset set1 set2

Full Usage: NonEmptySet.isSubset set1 set2

Parameters:
Returns: bool True if set1 is a subset of set2.

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

set1 : NonEmptySet<'a>

The potential subset.

set2 : NonEmptySet<'a>

The set to test against.

Returns: bool

True if set1 is a subset of set2.

NonEmptySet.isSuperset set1 set2

Full Usage: NonEmptySet.isSuperset set1 set2

Parameters:
Returns: bool True if set1 is a superset of set2.

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

set1 : NonEmptySet<'a>

The potential superset.

set2 : NonEmptySet<'a>

The set to test against.

Returns: bool

True if set1 is a superset of set2.

NonEmptySet.iter action set

Full Usage: NonEmptySet.iter action set

Parameters:
    action : 'a -> unit - The function to apply to each element.
    set : NonEmptySet<'a> - The input set.

Applies the given function to each element of the set, in order according to the comparison function.

action : 'a -> unit

The function to apply to each element.

set : NonEmptySet<'a>

The input set.

NonEmptySet.map mapping set

Full Usage: NonEmptySet.map mapping set

Parameters:
    mapping : 'a -> 'b - The function to transform elements of the input set.
    set : NonEmptySet<'a> - The input set.

Returns: NonEmptySet<'b> A set containing the transformed elements.

Returns a new collection containing the results of applying the given function to each element of the input set.

mapping : 'a -> 'b

The function to transform elements of the input set.

set : NonEmptySet<'a>

The input set.

Returns: NonEmptySet<'b>

A set containing the transformed elements.

NonEmptySet.maxElement set

Full Usage: NonEmptySet.maxElement set

Parameters:
Returns: 'a The max value from the set.

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

set : NonEmptySet<'a>

The input set.

Returns: 'a

The max value from the set.

NonEmptySet.minElement set

Full Usage: NonEmptySet.minElement set

Parameters:
Returns: 'a The min value from the set.

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

set : NonEmptySet<'a>

The input set.

Returns: 'a

The min value from the set.

NonEmptySet.ofArray array

Full Usage: NonEmptySet.ofArray array

Parameters:
    array : 'a array - The input array.

Returns: NonEmptySet<'a> Non empty set containing the elements of the array.

Builds a non empty set from the given array.

Throws exception for empty array

array : 'a array

The input array.

Returns: NonEmptySet<'a>

Non empty set containing the elements of the array.

ArgumentException Thrown when the input array is empty.

NonEmptySet.ofList list

Full Usage: NonEmptySet.ofList list

Parameters:
    list : 'a list - The input list.

Returns: NonEmptySet<'a> Non empty set containing the elements of the list.

Builds a non empty set from the given list.

Throws exception for empty list

list : 'a list

The input list.

Returns: NonEmptySet<'a>

Non empty set containing the elements of the list.

ArgumentException Thrown when the input list is empty.

NonEmptySet.ofNonEmptyList list

Full Usage: NonEmptySet.ofNonEmptyList list

Parameters:
Returns: NonEmptySet<'a> Non empty set containing the elements of the non-empty list.

Builds a non empty set from the given non-empty list.

list : NonEmptyList<'a>

The input list.

Returns: NonEmptySet<'a>

Non empty set containing the elements of the non-empty list.

NonEmptySet.ofNonEmptySeq source

Full Usage: NonEmptySet.ofNonEmptySeq source

Parameters:
Returns: NonEmptySet<'a> Non empty set containing the elements of the non-empty sequence.

Builds a non empty set from the given non-empty sequence.

source : NonEmptySeq<'a>

The input sequence.

Returns: NonEmptySet<'a>

Non empty set containing the elements of the non-empty sequence.

NonEmptySet.ofSeq seq

Full Usage: NonEmptySet.ofSeq seq

Parameters:
    seq : seq<'a> - The input list.

Returns: NonEmptySet<'a> Non empty set containing the elements of the list.

Builds a non empty set from the given sequence.

Throws exception for empty sequence

seq : seq<'a>

The input list.

Returns: NonEmptySet<'a>

Non empty set containing the elements of the list.

ArgumentException Thrown when the input list is empty.

NonEmptySet.ofSet set

Full Usage: NonEmptySet.ofSet set

Parameters:
    set : Set<'a> - The input set.

Returns: NonEmptySet<'a> Non empty set containing the elements of the set.

Builds a non empty set from the given set.

Throws exception for empty set

set : Set<'a>

The input set.

Returns: NonEmptySet<'a>

Non empty set containing the elements of the set.

ArgumentException Thrown when the input set is empty.

NonEmptySet.reduce reduction set

Full Usage: NonEmptySet.reduce reduction set

Parameters:
Returns: 'a
reduction : 'a -> 'a -> 'a
set : NonEmptySet<'a>
Returns: 'a

NonEmptySet.singleton x

Full Usage: NonEmptySet.singleton x

Parameters:
    x : 'a

Returns: NonEmptySet<'a>

Builds a non empty set with a single element.

x : 'a
Returns: NonEmptySet<'a>

NonEmptySet.toArray arg1

Full Usage: NonEmptySet.toArray arg1

Parameters:
Returns: 'a[]

Builds an array from the given non empty set.

arg0 : NonEmptySet<'a>
Returns: 'a[]

NonEmptySet.toList arg1

Full Usage: NonEmptySet.toList arg1

Parameters:
Returns: 'a list

Builds a list from the given non empty set.

arg0 : NonEmptySet<'a>
Returns: 'a list

NonEmptySet.toNonEmptyList arg1

Full Usage: NonEmptySet.toNonEmptyList arg1

Parameters:
Returns: NonEmptyList<'a>

Builds a non-empty list from the given non empty set.

arg0 : NonEmptySet<'a>
Returns: NonEmptyList<'a>

NonEmptySet.toNonEmptySeq set

Full Usage: NonEmptySet.toNonEmptySeq set

Parameters:
Returns: NonEmptySeq<'a>

Builds a non-empty sequence from the given non empty set.

set : NonEmptySet<'a>
Returns: NonEmptySeq<'a>

NonEmptySet.toSeq arg1

Full Usage: NonEmptySet.toSeq arg1

Parameters:
Returns: seq<'a>

Builds a sequence from the given non empty set.

arg0 : NonEmptySet<'a>
Returns: seq<'a>

NonEmptySet.toSet arg1

Full Usage: NonEmptySet.toSet arg1

Parameters:
Returns: Set<'a>

Builds a set from the given non empty set.

arg0 : NonEmptySet<'a>
Returns: Set<'a>

NonEmptySet.tryOfSet set

Full Usage: NonEmptySet.tryOfSet set

Parameters:
    set : Set<'a>

Returns: NonEmptySet<'a> option

Transforms a set to a NonEmptySet, returning an option to signal when the original set was empty.

set : Set<'a>
Returns: NonEmptySet<'a> option

NonEmptySet.union set1 set2

Full Usage: NonEmptySet.union set1 set2

Parameters:
Returns: NonEmptySet<'a> The union of set1 and set2.

Computes the union of the two sets.

set1 : NonEmptySet<'a>

The first input set.

set2 : NonEmptySet<'a>

The second input set.

Returns: NonEmptySet<'a>

The union of set1 and set2.

NonEmptySet.unionMany sets

Full Usage: NonEmptySet.unionMany sets

Parameters:
Returns: NonEmptySet<'a> The union of the input sets.

Computes the union of a non empty list of sets.

sets : NonEmptyList<NonEmptySet<'a>>

The sequence of sets to union.

Returns: NonEmptySet<'a>

The union of the input sets.