title: Idiomatic way in RxJS to calculate the maximum of a stream of values
body: <p>Calculating the maximum of a fixed stream is straightforward, for example:</p>
  
  <pre><code>var source = Rx.Observable.from([1,3,5,7,9,2,4,6,8]).max();
  </code></pre>
  
  <p>However this only generates one value (9 in this case).</p>
  
  <p>I would like to generate a sequence of maximum values so far, until the Observable produces a new maximum value. So the output would be something like [1, 3, 5, 7, 9].</p>
  
  <p>My idea so far has been to merge the output stream with maximum values, with the input stream (using <a href="https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/combinelatest.md" rel="nofollow">combineLatest</a>) and compare the two values. However this seems to be more complicated to me than it should be.</p>