Note in the docs that the zero value for fold and friends must be immutable #24971

This commit is contained in:
Jeffrey Chung 2018-06-19 06:33:49 -04:00 committed by Johan Andrén
parent 8ea9f9f32b
commit 72bd3cdfd4
10 changed files with 63 additions and 16 deletions

View file

@ -1,6 +1,6 @@
# fold
Start with current value `zero` and then apply the current and next value to the given function, when upstream complete the current value is emitted downstream.
Start with current value `zero` and then apply the current and next value to the given function. When upstream completes, the current value is emitted downstream.
@ref[Simple operators](../index.md#simple-operators)
@ -14,8 +14,10 @@ Start with current value `zero` and then apply the current and next value to the
## Description
Start with current value `zero` and then apply the current and next value to the given function, when upstream
complete the current value is emitted downstream.
Start with current value `zero` and then apply the current and next value to the given function. When upstream
completes, the current value is emitted downstream.
Note that the `zero` value must be immutable.
@@@div { .callout }

View file

@ -1,6 +1,6 @@
# foldAsync
Just like `fold` but receiving a function that results in a @scala[`Future`] @java[`CompletionStage`] to the next value.
Just like `fold` but receives a function that results in a @scala[`Future`] @java[`CompletionStage`] to the next value.
@ref[Simple operators](../index.md#simple-operators)
@ -14,7 +14,9 @@ Just like `fold` but receiving a function that results in a @scala[`Future`] @ja
## Description
Just like `fold` but receiving a function that results in a @scala[`Future`] @java[`CompletionStage`] to the next value.
Just like `fold` but receives a function that results in a @scala[`Future`] @java[`CompletionStage`] to the next value.
Note that the `zero` value must be immutable.
@@@div { .callout }

View file

@ -1,6 +1,6 @@
# scan
Emit its current value which starts at `zero` and then applies the current and next value to the given function emitting the next current value.
Emit its current value, which starts at `zero`, and then apply the current and next value to the given function, emitting the next current value.
@ref[Simple operators](../index.md#simple-operators)
@ -14,11 +14,11 @@ Emit its current value which starts at `zero` and then applies the current and n
## Description
Emit its current value which starts at `zero` and then applies the current and next value to the given function
emitting the next current value.
Emit its current value, which starts at `zero`, and then apply the current and next value to the given function,
emitting the next current value. This means that `scan` emits one element downstream before, and upstream elements
will not be requested until, the second element is required from downstream.
Note that this means that scan emits one element downstream before and upstream elements will not be requested until
the second element is required from downstream.
Note that the `zero` value must be immutable.
@@@div { .callout }

View file

@ -1,6 +1,6 @@
# scanAsync
Just like `scan` but receiving a function that results in a @scala[`Future`] @java[`CompletionStage`] to the next value.
Just like `scan` but receives a function that results in a @scala[`Future`] @java[`CompletionStage`] to the next value.
@ref[Simple operators](../index.md#simple-operators)
@ -14,7 +14,9 @@ Just like `scan` but receiving a function that results in a @scala[`Future`] @ja
## Description
Just like `scan` but receiving a function that results in a @scala[`Future`] @java[`CompletionStage`] to the next value.
Just like `scan` but receives a function that results in a @scala[`Future`] @java[`CompletionStage`] to the next value.
Note that the `zero` value must be immutable.
@@@div { .callout }

View file

@ -126,8 +126,8 @@ depending on being backpressured by downstream or not.
|Source/Flow|<a name="dropwhile"></a>@ref[dropWhile](Source-or-Flow/dropWhile.md)|Drop elements as long as a predicate function return true for the element|
|Source/Flow|<a name="filter"></a>@ref[filter](Source-or-Flow/filter.md)|Filter the incoming elements using a predicate.|
|Source/Flow|<a name="filternot"></a>@ref[filterNot](Source-or-Flow/filterNot.md)|Filter the incoming elements using a predicate.|
|Source/Flow|<a name="fold"></a>@ref[fold](Source-or-Flow/fold.md)|Start with current value `zero` and then apply the current and next value to the given function, when upstream complete the current value is emitted downstream.|
|Source/Flow|<a name="foldasync"></a>@ref[foldAsync](Source-or-Flow/foldAsync.md)|Just like `fold` but receiving a function that results in a @scala[`Future`] @java[`CompletionStage`] to the next value.|
|Source/Flow|<a name="fold"></a>@ref[fold](Source-or-Flow/fold.md)|Start with current value `zero` and then apply the current and next value to the given function. When upstream completes, the current value is emitted downstream.|
|Source/Flow|<a name="foldasync"></a>@ref[foldAsync](Source-or-Flow/foldAsync.md)|Just like `fold` but receives a function that results in a @scala[`Future`] @java[`CompletionStage`] to the next value.|
|Source/Flow|<a name="grouped"></a>@ref[grouped](Source-or-Flow/grouped.md)|Accumulate incoming events until the specified number of elements have been accumulated and then pass the collection of elements downstream.|
|Source/Flow|<a name="intersperse"></a>@ref[intersperse](Source-or-Flow/intersperse.md)|Intersperse stream with provided element similar to `List.mkString`.|
|Flow|<a name="lazyinitasync"></a>@ref[lazyInitAsync](Flow/lazyInitAsync.md)|Creates a real `Flow` upon receiving the first element by calling relevant `flowFactory` given as an argument.|
@ -141,8 +141,8 @@ depending on being backpressured by downstream or not.
|Source/Flow|<a name="recoverwith"></a>@ref[recoverWith](Source-or-Flow/recoverWith.md)|Allow switching to alternative Source when a failure has happened upstream.|
|Source/Flow|<a name="recoverwithretries"></a>@ref[recoverWithRetries](Source-or-Flow/recoverWithRetries.md)|RecoverWithRetries allows to switch to alternative Source on flow failure.|
|Source/Flow|<a name="reduce"></a>@ref[reduce](Source-or-Flow/reduce.md)|Start with first element and then apply the current and next value to the given function, when upstream complete the current value is emitted downstream.|
|Source/Flow|<a name="scan"></a>@ref[scan](Source-or-Flow/scan.md)|Emit its current value which starts at `zero` and then applies the current and next value to the given function emitting the next current value.|
|Source/Flow|<a name="scanasync"></a>@ref[scanAsync](Source-or-Flow/scanAsync.md)|Just like `scan` but receiving a function that results in a @scala[`Future`] @java[`CompletionStage`] to the next value.|
|Source/Flow|<a name="scan"></a>@ref[scan](Source-or-Flow/scan.md)|Emit its current value, which starts at `zero`, and then apply the current and next value to the given function, emitting the next current value.|
|Source/Flow|<a name="scanasync"></a>@ref[scanAsync](Source-or-Flow/scanAsync.md)|Just like `scan` but receives a function that results in a @scala[`Future`] @java[`CompletionStage`] to the next value.|
|Source/Flow|<a name="sliding"></a>@ref[sliding](Source-or-Flow/sliding.md)|Provide a sliding window over the incoming stream and pass the windows as groups of elements downstream.|
|Source/Flow|<a name="statefulmapconcat"></a>@ref[statefulMapConcat](Source-or-Flow/statefulMapConcat.md)|Transform each element into zero or more elements that are individually passed downstream.|
|Source/Flow|<a name="take"></a>@ref[take](Source-or-Flow/take.md)|Pass `n` incoming elements downstream and then complete|