FSharpPlus


NonEmptyList Module

Basic operations on NonEmptyList

Functions and values

Function or value Description

NonEmptyList.average list

Full Usage: NonEmptyList.average list

Parameters:
Returns: ^T The resulting average.
Modifiers: inline
Type parameters: ^T

Returns the average of the elements in the list.

list : NonEmptyList<^T>

The input list.

Returns: ^T

The resulting average.

NonEmptyList.averageBy projection list

Full Usage: NonEmptyList.averageBy projection list

Parameters:
    projection : 'T -> ^U - The function to transform the list elements into the type to be averaged.
    list : NonEmptyList<'T> - The input list.

Returns: ^U The resulting average.
Modifiers: inline
Type parameters: 'T, ^U

Returns the average of the elements generated by applying the function to each element of the list.

projection : 'T -> ^U

The function to transform the list elements into the type to be averaged.

list : NonEmptyList<'T>

The input list.

Returns: ^U

The resulting average.

NonEmptyList.choice list

Full Usage: NonEmptyList.choice list

Parameters:
Returns: ^Alt<'T>
Modifiers: inline
Type parameters: ^Alt<'T>

Reduces using alternative operator `<|>`.

list : NonEmptyList<^Alt<'T>>
Returns: ^Alt<'T>

NonEmptyList.cons e arg2

Full Usage: NonEmptyList.cons e arg2

Parameters:
Returns: NonEmptyList<'a>

Returns a new NonEmptyList with the element added to the beginning.

e : 'a
arg1 : NonEmptyList<'a>
Returns: NonEmptyList<'a>

NonEmptyList.create x xs

Full Usage: NonEmptyList.create x xs

Parameters:
    x : 'a
    xs : 'a list

Returns: NonEmptyList<'a>

Builds a non empty list.

x : 'a
xs : 'a list
Returns: NonEmptyList<'a>

NonEmptyList.distinct list

Full Usage: NonEmptyList.distinct list

Parameters:
Returns: NonEmptyList<'T> The resulting list without duplicates.

Returns a list that contains no duplicate entries according to the generic hash and equality comparisons on the keys returned by the given key-generating function. If an element occurs multiple times in the list then the later occurrences are discarded.

list : NonEmptyList<'T>

The input list.

Returns: NonEmptyList<'T>

The resulting list without duplicates.

NonEmptyList.head arg1

Full Usage: NonEmptyList.head arg1

Parameters:
Returns: 'a

Returns the first element of a new non empty list. You can also use property nel.Head.

arg0 : NonEmptyList<'a>
Returns: 'a

NonEmptyList.length nel

Full Usage: NonEmptyList.length nel

Parameters:
Returns: int

Returns the length of a non empty list. You can also use property nel.Length.

nel : NonEmptyList<'a>
Returns: int

NonEmptyList.map f arg2

Full Usage: NonEmptyList.map f arg2

Parameters:
Returns: NonEmptyList<'b>

Build a new non empty list whose elements are the results of applying the given function to each of the elements of the non empty list.

f : 'a -> 'b
arg1 : NonEmptyList<'a>
Returns: NonEmptyList<'b>

NonEmptyList.map2Shortest f l1 l2

Full Usage: NonEmptyList.map2Shortest f l1 l2

Parameters:
Returns: NonEmptyList<'c>

Safely build a new non empty list whose elements are the results of applying the given function to each of the elements of the two non empty list pairwise.

f : 'a -> 'b -> 'c
l1 : NonEmptyList<'a>
l2 : NonEmptyList<'b>
Returns: NonEmptyList<'c>

NonEmptyList.mapi f arg2

Full Usage: NonEmptyList.mapi f arg2

Parameters:
Returns: NonEmptyList<'b>

Build a new non empty list whose elements are the results of applying the given function with index to each of the elements of the non empty list.

f : int -> 'a -> 'b
arg1 : NonEmptyList<'a>
Returns: NonEmptyList<'b>

NonEmptyList.max list

Full Usage: NonEmptyList.max list

Parameters:
Returns: 'T The maximum element.

Returns the greatest of all elements of the list, compared via Operators.max.

list : NonEmptyList<'T>

The input list.

Returns: 'T

The maximum element.

NonEmptyList.maxBy projection list

Full Usage: NonEmptyList.maxBy projection list

Parameters:
    projection : 'T -> 'U - The function to transform the list elements into the type to be compared.
    list : NonEmptyList<'T> - The input list.

Returns: 'T The maximum element.

Returns the greatest of all elements of the list, compared via Operators.max on the function result.

projection : 'T -> 'U

The function to transform the list elements into the type to be compared.

list : NonEmptyList<'T>

The input list.

Returns: 'T

The maximum element.

NonEmptyList.min list

Full Usage: NonEmptyList.min list

Parameters:
Returns: 'T The minimum value.

Returns the lowest of all elements of the list, compared via Operators.min.

list : NonEmptyList<'T>

The input list.

Returns: 'T

The minimum value.

NonEmptyList.minBy projection list

Full Usage: NonEmptyList.minBy projection list

Parameters:
    projection : 'T -> 'U - The function to transform list elements into the type to be compared.
    list : NonEmptyList<'T> - The input list.

Returns: 'T The minimum value.

Returns the lowest of all elements of the list, compared via Operators.min on the function result

projection : 'T -> 'U

The function to transform list elements into the type to be compared.

list : NonEmptyList<'T>

The input list.

Returns: 'T

The minimum value.

NonEmptyList.ofArray array

Full Usage: NonEmptyList.ofArray array

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

Returns: NonEmptyList<'a> Non empty list containing the elements of the array.

Builds a non empty list from the given array.

Throws exception for empty array

array : 'a array

The input array.

Returns: NonEmptyList<'a>

Non empty list containing the elements of the array.

ArgumentException Thrown when the input array is empty.

NonEmptyList.ofList list

Full Usage: NonEmptyList.ofList list

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

Returns: NonEmptyList<'c> Non empty list containing the elements of the list.

Builds a non empty list from the given list.

Throws exception for empty list

list : 'c list

The input list.

Returns: NonEmptyList<'c>

Non empty list containing the elements of the list.

ArgumentException Thrown when the input list is empty.

NonEmptyList.ofNonEmptySeq s

Full Usage: NonEmptyList.ofNonEmptySeq s

Parameters:
Returns: NonEmptyList<'a>
s : NonEmptySeq<'a>
Returns: NonEmptyList<'a>

NonEmptyList.ofSeq seq

Full Usage: NonEmptyList.ofSeq seq

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

Returns: NonEmptyList<'b> Non empty list containing the elements of the list.

Builds a non empty list from the given sequence.

Throws exception for empty list

seq : seq<'b>

The input list.

Returns: NonEmptyList<'b>

Non empty list containing the elements of the list.

ArgumentException Thrown when the input list is empty.

NonEmptyList.range start stop

Full Usage: NonEmptyList.range start stop

Parameters:
    start : ^T
    stop : ^T

Returns: NonEmptyList<^T>
Modifiers: inline
Type parameters: ^T

Equivalent to [start..stop] on regular lists.

start : ^T
stop : ^T
Returns: NonEmptyList<^T>

NonEmptyList.reduce reduction list

Full Usage: NonEmptyList.reduce reduction list

Parameters:
    reduction : 'T -> 'T -> 'T - The function to reduce two list elements to a single element.
    list : NonEmptyList<'T> - The input list.

Returns: 'T The final reduced value.

Applies a function to each element of the list, threading an accumulator argument through the computation. Apply the function to the first two elements of the list. Then feed this result into the function along with the third element and so on. Return the final result. If the input function is f and the elements are i0...iN then computes f (... (f i0 i1) i2 ...) iN.

reduction : 'T -> 'T -> 'T

The function to reduce two list elements to a single element.

list : NonEmptyList<'T>

The input list.

Returns: 'T

The final reduced value.

NonEmptyList.reduceBack reduction list

Full Usage: NonEmptyList.reduceBack reduction list

Parameters:
    reduction : 'T -> 'T -> 'T - A function that takes in the next-to-last element of the list and the current accumulated result to produce the next accumulated result.
    list : NonEmptyList<'T> - The input list.

Returns: 'T The final result of the reductions.

Applies a function to each element of the list, starting from the end, threading an accumulator argument through the computation. If the input function is f and the elements are i0...iN then computes f i0 (...(f iN-1 iN)).

reduction : 'T -> 'T -> 'T

A function that takes in the next-to-last element of the list and the current accumulated result to produce the next accumulated result.

list : NonEmptyList<'T>

The input list.

Returns: 'T

The final result of the reductions.

NonEmptyList.sequence source

Full Usage: NonEmptyList.sequence source

Parameters:
Returns: ^Functor>
Modifiers: inline

Evaluates each action in the list from left to right and collect the results.

source : NonEmptyList<^Functor<'T>>
Returns: ^Functor>

NonEmptyList.singleton x

Full Usage: NonEmptyList.singleton x

Parameters:
    x : 'a

Returns: NonEmptyList<'a>

Builds a non empty list with a single element.

x : 'a
Returns: NonEmptyList<'a>

NonEmptyList.tail arg1

Full Usage: NonEmptyList.tail arg1

Parameters:
Returns: NonEmptyList<'a>

Returns a new NonEmptyList of the elements trailing the first element.

Throws exception for empty tail

arg0 : NonEmptyList<'a>
Returns: NonEmptyList<'a>
ArgumentException Thrown when the tail is empty.

NonEmptyList.tails s

Full Usage: NonEmptyList.tails s

Parameters:
Returns: NonEmptyList<NonEmptyList<'a>>
s : NonEmptyList<'a>
Returns: NonEmptyList<NonEmptyList<'a>>

NonEmptyList.toArray nel

Full Usage: NonEmptyList.toArray nel

Parameters:
Returns: 'a[]

Builds an array from the given non empty list.

nel : NonEmptyList<'a>
Returns: 'a[]

NonEmptyList.toList arg1

Full Usage: NonEmptyList.toList arg1

Parameters:
Returns: 'a list

Builds a list from the given non empty list.

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

NonEmptyList.toNonEmptySeq list

Full Usage: NonEmptyList.toNonEmptySeq list

Parameters:
Returns: NonEmptySeq<'a>
list : NonEmptyList<'a>
Returns: NonEmptySeq<'a>

NonEmptyList.toSeq arg1

Full Usage: NonEmptyList.toSeq arg1

Parameters:
Returns: seq<'b>

Builds a sequence from the given non empty list.

arg0 : NonEmptyList<'b>
Returns: seq<'b>

NonEmptyList.traverse f source

Full Usage: NonEmptyList.traverse f source

Parameters:
Returns: ^Functor>
Modifiers: inline

Maps each element of the list to an action, evaluates these actions from left to right and collect the results.

f : 'T -> ^Functor<'U>
source : NonEmptyList<'T>
Returns: ^Functor>

NonEmptyList.tryOfList s

Full Usage: NonEmptyList.tryOfList s

Parameters:
    s : 'a list

Returns: NonEmptyList<'a> option

Transforms a list to a NonEmptyList, returning an option to signal when the original list was empty.

s : 'a list
Returns: NonEmptyList<'a> option

NonEmptyList.unzip list

Full Usage: NonEmptyList.unzip list

Parameters:
Returns: NonEmptyList<'T1> * NonEmptyList<'T2> Two lists of split elements.

Splits a list of pairs into two lists.

list : NonEmptyList<'T1 * 'T2>

The input list.

Returns: NonEmptyList<'T1> * NonEmptyList<'T2>

Two lists of split elements.

NonEmptyList.zip list1 list2

Full Usage: NonEmptyList.zip list1 list2

Parameters:
Returns: NonEmptyList<'T * 'U> A single list containing pairs of matching elements from the input lists.

Combines the two lists into a list of pairs. The two lists must have equal lengths.

list1 : NonEmptyList<'T>

The first input list.

list2 : NonEmptyList<'U>

The second input list.

Returns: NonEmptyList<'T * 'U>

A single list containing pairs of matching elements from the input lists.

NonEmptyList.zipShortest list1 list2

Full Usage: NonEmptyList.zipShortest list1 list2

Parameters:
Returns: NonEmptyList<'T * 'U> List with corresponding pairs of input lists.

Zip safely two lists. If one list is shorter, excess elements are discarded from the right end of the longer list.

list1 : NonEmptyList<'T>

First input list.

list2 : NonEmptyList<'U>

Second input list.

Returns: NonEmptyList<'T * 'U>

List with corresponding pairs of input lists.