package lambda_streams
Install
Dune Dependency
Authors
Maintainers
Sources
md5=8c1ce04ee769b56434696bd57aee1a5b
sha512=9bb794f3852da60e536277f41ca5c6db678e5f0f5100ca13bf4c054a8d5c17834891c9ba2d73ddd35dc4f52f4b8be6076611b8f8c413eb6e93d61c161c67f9aa
doc/lambda_streams/Lambda_streams/Sync/index.html
Module Lambda_streams.Sync
Source
Generalizes the notion of a synchronous, readable input stream.
Generalizes the notion of a synchronous, writable output stream.
Represents a connection-based input stream with an output stream to close it.
Creates a mutator: a pair of input and output streams that together behave like a mutable variable. Mutating the value is accomplished by sending data to the output stream. Fetching the current value is done by reading the input stream.
Gets the next value (or current value if it's a behavior) from the input stream.
Sends a single value to the output stream. Semantically equivalent to:
Finite.Sync.pure value |> Finite.Sync.pipe output_stream
But it's more efficient because it doesn't involve instatiating an input stream.
Like fold_left but for infinite streams, ending at signal n.
Filters the input stream based on a predicate. This function returns a stream that, when invoked, will continue to invoke the original input stream until a value that satisfies the predicate is given, which is then returned. This means that an invocation of the returned stream may possibly never terminate.
For example:
enumerate () |> filter ((>=) 10)
Will block and never terminate after 10
invocations, because after those invocations any future values of enumerate ()
will never be less than 10
.
On the other hand,
let is_even x = x mod 2 = 0 in
enumerate () |> filter is_even
Will always return a value, because there will always be a successor to a natural number that is even (every other number).