AsyncSeq Module
Types
| Type | Description |
|
Computation builder that allows creating of asynchronous sequences using the 'asyncSeq { ... }' syntax |
Functions and values
| Function or value |
Description
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Asynchronously iterates over the input sequence and generates 'x' for every input element for which the specified asynchronous function returned 'Some(x)' The specified function is asynchronous (and the input sequence will be asked for the next element after the processing of an element completes).
|
|
|
|
|
|
|
|
Creates an asynchronous sequence that iterates over the given input sequence. For every input element, it calls the the specified function and iterates over all elements generated by that asynchronous sequence. This is the 'bind' operation of the computation expression (exposed using the 'for' keyword in asyncSeq computation).
|
|
|
|
Merges two async sequences. The resulting async sequence produces an element when either input sequence produces an element, passing the new element from the emitting sequence and the previously emitted element from the other sequence. If either of the input sequences is empty, the resulting sequence is empty.
|
|
Merges two async sequences using the specified combine function. The resulting async sequence produces an element when either input sequence produces an element, passing the new element from the emitting sequence and the previously emitted element from the other sequence. If either of the input sequences is empty, the resulting sequence is empty.
|
|
Merges two async sequences using the specified combine function. The resulting async sequence produces an element when either input sequence produces an element, passing the new element from the emitting sequence and the previously emitted element from the other sequence. If either of the input sequences is empty, the resulting sequence is empty.
|
|
|
|
Compares two async sequences lexicographically using the given asynchronous comparison function. Returns a negative integer if source1 < source2, 0 if equal, and a positive integer if source1 > source2.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Creates an empty asynchronous sequence that immediately ends.
|
|
|
|
|
|
|
|
|
|
|
|
Builds a new asynchronous sequence whose elements are those from the input sequence for which the specified function returned true. The specified function is asynchronous (and the input sequence will be asked for the next element after the processing of an element completes).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Full Usage:
AsyncSeq.fromChannel reader
Parameters:
ChannelReader<'T>
Returns: AsyncSeq<'T>
|
Creates an async seq from a channel reader. The async seq will read values from the channel reader until it is closed. If the reader raises an error than the sequence will raise it.
|
|
|
|
Applies a key-generating function to each element and returns an async sequence containing unique keys and async sequences containing elements corresponding to the key. Note that the resulting async sequence has to be processed in parallel (e.g AsyncSeq.mapAsyncParallel) becaused completion of sub-sequences depends on completion of other sub-sequences.
|
|
Applies a key-generating function to each element and returns an async sequence containing unique keys and async sequences containing elements corresponding to the key. Note that the resulting async sequence has to be processed in parallel (e.g AsyncSeq.mapAsyncParallel) becaused completion of sub-sequences depends on completion of other sub-sequences. |
|
|
|
|
Full Usage:
AsyncSeq.init count mapping
Parameters:
int64
mapping : int64 -> 'T
Returns: AsyncSeq<'T>
|
Generates a finite async sequence using the specified initialization function.
|
|
|
|
Generates an infinite async sequence using the specified initialization function.
|
|
|
|
Returns a new asynchronous sequence with the given value inserted before the element at the specified index. An index equal to the length of the sequence appends the value at the end. Raises ArgumentException if index is negative or greater than the sequence length. Mirrors Seq.insertAt.
|
|
|
|
|
|
Interleaves a sequence of async sequences into a resulting async sequence. The provided sequences are consumed in lock-step.
|
|
|
|
|
|
|
|
|
|
|
|
|
Iterates over the input sequence and calls the specified asynchronous function for every value. Each action computation is started but not awaited before consuming the next item from the sequence, thereby iterating in parallel with a specified degree of parallelism.
|
|
|
|
|
Iterates over the input sequence and calls the specified asynchronous function for every value, passing along the index of that element. The input sequence will be asked for the next element after the processing of an element completes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Builds a new asynchronous sequence whose elements are generated by applying the specified function to all elements of the input sequence. The specified function is asynchronous (and the input sequence will be asked for the next element after the processing of an element completes).
|
|
Builds a new asynchronous sequence whose elements are generated by applying the specified function to all elements of the input sequence. The function is applied to elements in order and results are emitted in order, but in parallel, without waiting for a prior mapping operation to complete. Parallelism is bound by the ThreadPool.
|
|
Builds a new asynchronous sequence whose elements are generated by applying the specified function to all elements of the input sequence. The function is applied to elements in parallel, and results are emitted in the order they complete (unordered), without preserving the original order. This can provide better performance than mapAsyncParallel when order doesn't matter. Parallelism is bound by the ThreadPool.
|
Builds a new asynchronous sequence whose elements are generated by
applying the specified function to all elements of the input sequence,
with at most
|
|
|
Maps each element of the async sequence with a folder function that also threads an accumulator state through the computation. Returns the array of results and the final state, mirroring Seq.mapFold.
|
|
Asynchronously maps each element of the async sequence with an asynchronous folder function that also threads an accumulator state through the computation. Returns the array of results and the final state, mirroring Seq.mapFold.
|
|
Builds a new asynchronous sequence whose elements are generated by applying the specified function to all elements of the input sequence. The specified function is synchronous (and the input sequence will be asked for the next element after the processing of an element completes).
|
|
Builds a new asynchronous sequence whose elements are generated by applying the specified function to all elements of the input sequence. The specified function is asynchronous (and the input sequence will be asked for the next element after the processing of an element completes).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Full Usage:
AsyncSeq.ofObservableBuffered source
Parameters:
IObservable<'T>
Returns: AsyncSeq<'T>
|
Converts observable to an asynchronous sequence. Values that are produced by the observable while the asynchronous sequence is blocked are stored to an unbounded buffer and are returned as next elements of the async sequence.
|
|
Creates an asynchronous sequence that lazily takes element from an input synchronous sequence and returns them one-by-one.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Creates an async sequence which repeats the specified value the indicated number of times.
|
|
|
|
|
|
|
|
|
|
|
|
Aggregates the elements of the input asynchronous sequence using the specified 'aggregation' function. The result is an asynchronous sequence of intermediate aggregation result. The aggregation function is asynchronous (and the input sequence will be asked for the next element after the processing of an element completes).
|
|
Creates an asynchronous sequence that generates a single element and then ends.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Yields a sequence ordered by keys. This function returns a sequence that digests the whole initial sequence as soon as that sequence is iterated. As a result this function should not be used with large or infinite sequences.
|
Full Usage:
AsyncSeq.sortBy projection source
Parameters:
'T -> 'Key
source : AsyncSeq<'T>
Returns: 'T array
|
Applies a key-generating function to each element of an AsyncSeq and yield an array ordered by keys. This function returns an array that digests the whole initial sequence as soon as that sequence is iterated. As a result this function should not be used with large or infinite sequences.
|
Full Usage:
AsyncSeq.sortByDescending projection source
Parameters:
'T -> 'Key
source : AsyncSeq<'T>
Returns: 'T array
|
Applies a key-generating function to each element of an AsyncSeq and yield an array ordered descending by keys. This function returns an array that digests the whole initial sequence as soon as that sequence is iterated. As a result this function should not be used with large or infinite sequences.
|
|
Yields an array ordered descending by keys. This function returns an array that digests the whole initial sequence as soon as that sequence is iterated. As a result this function should not be used with large or infinite sequences.
|
Full Usage:
AsyncSeq.sortWith comparer source
Parameters:
'T -> 'T -> int
source : AsyncSeq<'T>
Returns: 'T array
|
Sorts the given async sequence using the given comparison function and returns an array. This function returns an array that digests the whole initial sequence as soon as that sequence is iterated. As a result this function should not be used with large or infinite sequences.
|
|
Splits an async sequence at the given index. Returns an async computation that yields the first `count` elements as an array and the remaining elements as a new AsyncSeq. The source is enumerated once; the returned AsyncSeq lazily produces the remainder.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Synchronously iterates the AsyncSeq and collects the output into an array.
|
|
Converts asynchronous sequence to a synchronous blocking sequence. The elements of the asynchronous sequence are consumed lazily.
|
Full Usage:
AsyncSeq.toChannel writer source
Parameters:
ChannelWriter<'T>
source : AsyncSeq<'T>
Returns: Async<unit>
|
Fills a channel writer with the values from an async seq. The writer will be closed when the async seq completes or raises an error.
|
|
|
|
Synchronously iterates the AsyncSeq and collects the output into a list.
|
|
Converts asynchronous sequence to an IObservable<_>. When the client subscribes to the observable, a new copy of asynchronous sequence is started and is sequentially iterated over (at the maximal possible speed). Disposing of the observer cancels the iteration over asynchronous sequence.
|
Traverses an async sequence an applies to specified function such that if Choice2Of2 is returned the traversal short-circuits and Choice2Of2 is returned as the result. Otherwise, the entire sequence is traversed and the result returned as Choice1Of2. |
|
|
Traverses an async sequence an applies to specified function such that if None is returned the traversal short-circuits and None is returned as the result. Otherwise, the entire sequence is traversed and the result returned as Some. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Full Usage:
AsyncSeq.unfold generator state
Parameters:
'State -> ('T * 'State) option
state : 'State
Returns: AsyncSeq<'T>
|
Generates an async sequence using the specified generator function.
|
|
|
|
|
|
|
|
|
|
Returns an asynchronous sequence that yields sliding windows of the given size
over the source sequence, each yielded as an array. The first window is emitted
once
|
Full Usage:
AsyncSeq.withCancellation cancellationToken source
Parameters:
CancellationToken
source : AsyncSeq<'T>
Returns: AsyncSeq<'T>
|
Returns a new
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FSharp.Control.AsyncSeq