FSharpPlus


Enumerator Module

Additional operations on IEnumerator

Functions and values

Function or value Description

Enumerator.Empty ()

Full Usage: Enumerator.Empty ()

Parameters:
    () : unit

Returns: IEnumerator<'T>

Constructs an EmptyEnumerator of type 'T.

() : unit
Returns: IEnumerator<'T>

Enumerator.choose chooser e

Full Usage: Enumerator.choose chooser e

Parameters:
    chooser : 'T -> 'U option - The function to apply to each triple of elements from the input Enumerators.
    e : IEnumerator<'T> - The input Enumerator.

Returns: IEnumerator<'U> A new Enumerator of values selected from the chooser function.

Applies the given function to each element in the input Enumerator. Returns an Enumerator comprised of the resuls x for each element where the function returns Some(x).

chooser : 'T -> 'U option

The function to apply to each triple of elements from the input Enumerators.

e : IEnumerator<'T>

The input Enumerator.

Returns: IEnumerator<'U>

A new Enumerator of values selected from the chooser function.

Enumerator.concat sources

Full Usage: Enumerator.concat sources

Parameters:
Returns: IEnumerator<'b> A concatenated enumeration of the given Enumerator sources.

Enumerates the elements of each of the Enumerators in order.

sources : IEnumerator<IEnumerator<'b>>

The source Enumerator of Enumerators.

Returns: IEnumerator<'b>

A concatenated enumeration of the given Enumerator sources.

Enumerator.filter predicate e

Full Usage: Enumerator.filter predicate e

Parameters:
    predicate : 'T -> bool - The function to test the input elements.
    e : IEnumerator<'T> - The input Enumerator.

Returns: IEnumerator<'T> A new Enumerator yielding only elements that satsify the predicate.

Returns a new Enumerator yielding only the elements of the input Enumerator for which the given predicate returns "true".

predicate : 'T -> bool

The function to test the input elements.

e : IEnumerator<'T>

The input Enumerator.

Returns: IEnumerator<'T>

A new Enumerator yielding only elements that satsify the predicate.

Enumerator.map f e

Full Usage: Enumerator.map f e

Parameters:
    f : 'a -> 'b - The function to apply.
    e : IEnumerator<'a> - The input Enumerator.

Returns: IEnumerator<'b> A new Enumerator of mapped elements.

Maps over an enumerator.

f : 'a -> 'b

The function to apply.

e : IEnumerator<'a>

The input Enumerator.

Returns: IEnumerator<'b>

A new Enumerator of mapped elements.

Enumerator.map2 f e1 e2

Full Usage: Enumerator.map2 f e1 e2

Parameters:
    f : 'a -> 'b -> 'c - The function to apply to each pair of elements from the input Enumerators.
    e1 : IEnumerator<'a> - The first input Enumerator.
    e2 : IEnumerator<'b> - The second input Enumerator.

Returns: IEnumerator<'c> A new Enumerator of mapped elements.

Maps over two Enumerators, with the mapping function is given the corresponding elements of the two Enumerators pairwise.

Stops enumerating when either of the input Enumerators are finished enumerating.

f : 'a -> 'b -> 'c

The function to apply to each pair of elements from the input Enumerators.

e1 : IEnumerator<'a>

The first input Enumerator.

e2 : IEnumerator<'b>

The second input Enumerator.

Returns: IEnumerator<'c>

A new Enumerator of mapped elements.

Enumerator.map3 f e1 e2 e3

Full Usage: Enumerator.map3 f e1 e2 e3

Parameters:
    f : 'e -> 'f -> 'g -> 'h - The function to apply to each triple of elements from the input Enumerators.
    e1 : IEnumerator<'e> - The first input Enumerator.
    e2 : IEnumerator<'f> - The second input Enumerator.
    e3 : IEnumerator<'g> - The third input Enumerator.

Returns: IEnumerator<'h> A new Enumerator of mapped elements.

Maps over three Enumerators, where the mapping function is given the corresponding elements of the three Enumerators.

Stops enumerating when any of the input Enumerators are finished enumerating.

f : 'e -> 'f -> 'g -> 'h

The function to apply to each triple of elements from the input Enumerators.

e1 : IEnumerator<'e>

The first input Enumerator.

e2 : IEnumerator<'f>

The second input Enumerator.

e3 : IEnumerator<'g>

The third input Enumerator.

Returns: IEnumerator<'h>

A new Enumerator of mapped elements.

Enumerator.mapi f e

Full Usage: Enumerator.mapi f e

Parameters:
    f : int -> 'a -> 'b - The function to apply, which is given both the index and the element.
    e : IEnumerator<'a> - The input Enumerator.

Returns: IEnumerator<'b> A new Enumerator of mapped elements.

Maps over an Enumerator, with the mapping function also given the index.

f : int -> 'a -> 'b

The function to apply, which is given both the index and the element.

e : IEnumerator<'a>

The input Enumerator.

Returns: IEnumerator<'b>

A new Enumerator of mapped elements.

Enumerator.mapi2 f e1 e2

Full Usage: Enumerator.mapi2 f e1 e2

Parameters:
    f : int -> 'a -> 'b -> 'c - The function to apply to the index and each pair of elements from the input Enumerators.
    e1 : IEnumerator<'a> - The first input Enumerator.
    e2 : IEnumerator<'b> - The second input Enumerator.

Returns: IEnumerator<'c> A new Enumerator of mapped elements.

Maps over two Enumerators, where the mapping function is given the index and corresponding elements of the two input Enumerators pairwise.

Stops enumerating when either of the input Enumerators are finished enumerating.

f : int -> 'a -> 'b -> 'c

The function to apply to the index and each pair of elements from the input Enumerators.

e1 : IEnumerator<'a>

The first input Enumerator.

e2 : IEnumerator<'b>

The second input Enumerator.

Returns: IEnumerator<'c>

A new Enumerator of mapped elements.

Enumerator.nth index e

Full Usage: Enumerator.nth index e

Parameters:
    index : int - The index to retrieve.
    e : IEnumerator<'T> - The input Enumerator.

Returns: 'T The value at the given index or an exception is thrown if not found.

Retuns the nth element in the Enumerator.

This is called item in some other parts of core.

index : int

The index to retrieve.

e : IEnumerator<'T>

The input Enumerator.

Returns: 'T

The value at the given index or an exception is thrown if not found.

ArgumentException Thrown if the index is negative or the Enumerator does not contain enough elements.

Enumerator.singleton x

Full Usage: Enumerator.singleton x

Parameters:
    x : 'a

Returns: IEnumerator<'a>

Constructs an Enumerator that yields the single value given.

x : 'a
Returns: IEnumerator<'a>

Enumerator.tryItem index e

Full Usage: Enumerator.tryItem index e

Parameters:
    index : int - The index to retrieve.
    e : IEnumerator<'T> - The input Enumerator.

Returns: 'T option The value at the given index or None if not found.

Tries to find the nth element in the Enumerator. Returns None if index is negative or the Enumerator does not contain enough elements.

index : int

The index to retrieve.

e : IEnumerator<'T>

The input Enumerator.

Returns: 'T option

The value at the given index or None if not found.

Enumerator.unfold generator initialState

Full Usage: Enumerator.unfold generator initialState

Parameters:
    generator : 'a -> ('b * 'a) option - The function that takes the current state and returns an option tuple of the next element of the list and the next state value.
    initialState : 'a - The intitial state value.

Returns: IEnumerator<'b> A new Enumerator yielding only elements that satsify the predicate.

Returns a new Enumerator yielding elements x generated by the given computation so long as it generates a Some(x) - and stops when it generates a None. The given initial state argument is passed to the element generator.

generator : 'a -> ('b * 'a) option

The function that takes the current state and returns an option tuple of the next element of the list and the next state value.

initialState : 'a

The intitial state value.

Returns: IEnumerator<'b>

A new Enumerator yielding only elements that satsify the predicate.

Enumerator.upto lastOption f

Full Usage: Enumerator.upto lastOption f

Parameters:
    lastOption : int option - The last index to stop at -- or None to run forever, well as far as Int32.MaxValue.
    f : int -> 'U - The function to apply to each index.

Returns: IEnumerator<'U> An enumerator that yields upto the lastOption.

Enumerates from zero up to the given lastOption, yielding elements generated by the given function applied to the index.

The Current value for a valid index is "f i". Lazy<_> values are used as caches, to store either the result or an exception if thrown. These "Lazy<_>" caches are created only on the first call to current and forced immediately. The lazy creation of the cache nodes means enumerations that skip many Current values are not delayed by GC. For example, the full enumeration of Seq.initInfinite in the tests.

lastOption : int option

The last index to stop at -- or None to run forever, well as far as Int32.MaxValue.

f : int -> 'U

The function to apply to each index.

Returns: IEnumerator<'U>

An enumerator that yields upto the lastOption.

Enumerator.zip e1 e2

Full Usage: Enumerator.zip e1 e2

Parameters:
Returns: IEnumerator<'a * 'b> An Enumerator that enumerates pairs of two input Enumerators.

Zip two input Enumerators into a new Enumerator yielding pairs.

e1 : IEnumerator<'a>

The first input Enumerator.

e2 : IEnumerator<'b>

The second input Enumerator.

Returns: IEnumerator<'a * 'b>

An Enumerator that enumerates pairs of two input Enumerators.

Enumerator.zip3 e1 e2 e3

Full Usage: Enumerator.zip3 e1 e2 e3

Parameters:
Returns: IEnumerator<'a * 'b * 'c> An Enumerator that enumerates triples of three input Enumerators.

Zip three input Enumerators into a new Enumerator yielding triples.

e1 : IEnumerator<'a>

The first input Enumerator.

e2 : IEnumerator<'b>

The second input Enumerator.

e3 : IEnumerator<'c>

The third input Enumerator.

Returns: IEnumerator<'a * 'b * 'c>

An Enumerator that enumerates triples of three input Enumerators.