Streams


ParStream

Namespace: Nessos.Streams
Attributes:
[<RequireQualifiedAccess>]

Provides basic operations on Parallel Streams.

Nested types and modules

ModuleDescription
Internals

Internal entrypoints for compiled code.
Do not call these functions directly.

Functions and values

Function or valueDescription
ParStream.choose chooser stream
Signature: chooser:('T -> 'R option) -> stream:ParStream<'T> -> ParStream<'R>
Type parameters: 'T, 'R

Applies the given function to each element of the parallel stream and returns the parallel stream comprised of the results for each element where the function returns Some with some value.

ParStream.collect f stream
Signature: f:('T -> Stream<'R>) -> stream:ParStream<'T> -> ParStream<'R>
Type parameters: 'T, 'R

Transforms each element of the input parallel stream to a new stream and flattens its elements.

ParStream.countBy projection stream
Signature: projection:('T -> 'Key) -> stream:ParStream<'T> -> ParStream<'Key * int>
Type parameters: 'T, 'Key

Applies a key-generating function to each element of a ParStream and return a ParStream yielding unique keys and their number of occurrences in the original sequence.

ParStream.exists predicate stream
Signature: predicate:('T -> bool) -> stream:ParStream<'T> -> bool
Type parameters: 'T

Tests if any element of the stream satisfies the given predicate.

ParStream.filter predicate stream
Signature: predicate:('T -> bool) -> stream:ParStream<'T> -> ParStream<'T>
Type parameters: 'T

Filters the elements of the input parallel stream.

ParStream.find predicate stream
Signature: predicate:('T -> bool) -> stream:ParStream<'T> -> 'T
Type parameters: 'T

Returns the first element for which the given function returns true. Raises KeyNotFoundException if no such element exists.

ParStream.flatMap f stream
Signature: f:('T -> Stream<'R>) -> stream:ParStream<'T> -> ParStream<'R>
Type parameters: 'T, 'R

Transforms each element of the input parallel stream to a new stream and flattens its elements.

ParStream.fold(...)
Signature: folder:('State -> 'T -> 'State) -> combiner:('State -> 'State -> 'State) -> state:(unit -> 'State) -> stream:ParStream<'T> -> 'State
Type parameters: 'State, 'T

Applies a function to each element of the parallel stream, threading an accumulator argument through the computation. If the input function is f and the elements are i0...iN, then this function computes f (... (f s i0)...) iN.

ParStream.foldBy(...)
Signature: projection:('T -> 'Key) -> folder:('State -> 'T -> 'State) -> state:(unit -> 'State) -> stream:ParStream<'T> -> ParStream<'Key * 'State>
Type parameters: 'T, 'Key, 'State

Applies a key-generating function to each element of a ParStream and return a ParStream yielding unique keys and the result of the threading an accumulator.

ParStream.forall predicate stream
Signature: predicate:('T -> bool) -> stream:ParStream<'T> -> bool
Type parameters: 'T

Tests if all elements of the parallel stream satisfy the given predicate.

ParStream.groupBy projection stream
Signature: projection:('T -> 'Key) -> stream:ParStream<'T> -> ParStream<'Key * seq<'T>>
Type parameters: 'T, 'Key

Applies a key-generating function to each element of the input parallel stream and yields a parallel stream of unique keys and a sequence of all elements that have each key.

ParStream.head(stream)
Signature: stream:ParStream<'T> -> 'T
Type parameters: 'T

Returs the first element of the stream.

ParStream.isEmpty(stream)
Signature: stream:ParStream<'T> -> bool
Type parameters: 'T

Returs true if the stream is empty and false otherwise.

ParStream.iter f stream
Signature: f:('T -> unit) -> stream:ParStream<'T> -> unit
Type parameters: 'T

Applies the given function to each element of the parallel stream.

ParStream.length(stream)
Signature: stream:ParStream<'T> -> int
Type parameters: 'T

Returns the total number of elements of the parallel stream.

ParStream.map f stream
Signature: f:('T -> 'R) -> stream:ParStream<'T> -> ParStream<'R>
Type parameters: 'T, 'R

Transforms each element of the input parallel stream.

ParStream.mapi f stream
Signature: f:(int -> 'T -> 'R) -> stream:ParStream<'T> -> ParStream<'R>
Type parameters: 'T, 'R

Transforms each element of the input parallel stream. The integer index passed to the function indicates the index of element being transformed.

ParStream.maxBy projection source
Signature: projection:('T -> 'Key) -> source:ParStream<'T> -> 'T
Type parameters: 'T, 'Key

Locates the maximum element of the parallel stream by given key.

ParStream.minBy projection source
Signature: projection:('T -> 'Key) -> source:ParStream<'T> -> 'T
Type parameters: 'T, 'Key

Locates the minimum element of the parallel stream by given key.

ParStream.ofArray(source)
Signature: source:'T [] -> ParStream<'T>
Type parameters: 'T

Wraps array as a parallel stream.

ParStream.ofList(source)
Signature: source:'T list -> ParStream<'T>
Type parameters: 'T

Wraps list as a parallel stream.

ParStream.ofResizeArray(source)
Signature: source:ResizeArray<'T> -> ParStream<'T>
Type parameters: 'T

Wraps ResizeArray as a parallel stream.

ParStream.ofSeq(source)
Signature: source:seq<'T> -> ParStream<'T>
Type parameters: 'T

Wraps seq as a parallel stream.

ParStream.ofSeqs(sources)
Signature: sources:seq<'?13934> -> ParStream<'T>
Type parameters: '?13934, 'T

Wraps a collection of sequences as a parallel stream.

ParStream.ofSystemStreamByLine(mkStream)
Signature: mkStream:(unit -> '?13937) -> ParStream<string>
Type parameters: '?13937

Creates a parallel stream from a seekable read stream factory

ParStream.ofTextFileByLine(path)
Signature: path:string -> ParStream<string>

Creates a ParStream instance by reading a file in parallel

ParStream.ordered(stream)
Signature: stream:ParStream<'T> -> ParStream<'T>
Type parameters: 'T

Returns a parallel stream that preserves ordering.

ParStream.pick chooser stream
Signature: chooser:('T -> 'R option) -> stream:ParStream<'T> -> 'R
Type parameters: 'T, 'R

Applies the given function to successive elements, returning the first result where the function returns a Some value. Raises KeyNotFoundException when every item of the parallel stream evaluates to None when the given function is applied.

ParStream.skip n stream
Signature: n:int -> stream:ParStream<'T> -> ParStream<'T>
Type parameters: 'T

Returns a parallel stream that skips N elements of the input parallel stream and then yields the remaining elements of the stream.

ParStream.sortBy projection stream
Signature: projection:('T -> 'Key) -> stream:ParStream<'T> -> ParStream<'T>
Type parameters: 'T, 'Key

Applies a key-generating function to each element of the input parallel stream and yields a parallel stream ordered by keys.

ParStream.sortByDescending(...)
Signature: projection:('T -> 'Key) -> stream:ParStream<'T> -> ParStream<'T>
Type parameters: 'T, 'Key

Applies a key-generating function to each element of the input parallel stream and yields a parallel stream ordered by keys in descending order.

ParStream.sortByUsing(...)
Signature: projection:('T -> 'Key) -> comparer:IComparer<'Key> -> stream:ParStream<'T> -> ParStream<'T>
Type parameters: 'T, 'Key

Applies a key-generating function to each element of the input parallel stream and yields a parallel stream ordered using the given comparer for the keys.

ParStream.sum(stream)
Signature: stream:ParStream<^T> -> ^T
Type parameters: ^T

Returns the sum of the elements.

ParStream.take n stream
Signature: n:int -> stream:ParStream<'T> -> ParStream<'T>
Type parameters: 'T

Returns the elements of the parallel stream up to a specified count.

ParStream.toArray(stream)
Signature: stream:ParStream<'T> -> 'T []
Type parameters: 'T

Creates an array from the given parallel stream.

ParStream.toResizeArray(stream)
Signature: stream:ParStream<'T> -> ResizeArray<'T>
Type parameters: 'T

Creates an ResizeArray from the given parallel stream.

ParStream.toSeq(stream)
Signature: stream:ParStream<'T> -> seq<'T>
Type parameters: 'T

Creates an Seq from the given parallel stream.

ParStream.tryFind predicate stream
Signature: predicate:('T -> bool) -> stream:ParStream<'T> -> 'T option
Type parameters: 'T

Returns the first element for which the given function returns true. Returns None if no such element exists.

ParStream.tryHead(stream)
Signature: stream:ParStream<'T> -> 'T option
Type parameters: 'T

Returs the first element of the stream.

ParStream.tryPick chooser stream
Signature: chooser:('T -> 'R option) -> stream:ParStream<'T> -> 'R option
Type parameters: 'T, 'R

Applies the given function to successive elements, returning the first result where the function returns a Some value.

ParStream.unordered(stream)
Signature: stream:ParStream<'T> -> ParStream<'T>
Type parameters: 'T

Returns a parallel stream that is unordered.

ParStream.withDegreeOfParallelism(...)
Signature: degreeOfParallelism:int -> stream:ParStream<'T> -> ParStream<'T>
Type parameters: 'T

Returns a parallel stream with a new degree of parallelism.

Fork me on GitHub