/** PURE_IMPORTS_START .._operators_reduce PURE_IMPORTS_END */
import { reduce as higherOrderReduce } from '../operators/reduce';
/* tslint:enable:max-line-length */
/**
* Applies an accumulator function over the source Observable, and returns the
* accumulated result when the source completes, given an optional seed value.
*
* Combines together all values emitted on the source,
* using an accumulator function that knows how to join a new source value into
* the accumulation from the past.
*
*
*
* Like
* [Array.prototype.reduce()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce),
* `reduce` applies an `accumulator` function against an accumulation and each
* value of the source Observable (from the past) to reduce it to a single
* value, emitted on the output Observable. Note that `reduce` will only emit
* one value, only when the source Observable completes. It is equivalent to
* applying operator {@link scan} followed by operator {@link last}.
*
* Returns an Observable that applies a specified `accumulator` function to each
* item emitted by the source Observable. If a `seed` value is specified, then
* that value will be used as the initial value for the accumulator. If no seed
* value is specified, the first item of the source is used as the seed.
*
* @example