Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Aha! The <a href="http://channel9.msdn.com/posts/J.Van.Gogh/Reactive-Extensions-API-in-depth-Zip/" rel="nofollow noreferrer"><code>Zip</code> screencast</a> that I mentioned in the P.S. gave me a vital clue: <code>Zip</code> "remembers" items to account for the fact that items may arrive from one observable sooner than from the other. I'll attempt an answer to my question, I hope someone can correct me if I'm wrong.</p> <p><code>Zip</code> pairs up inputs from two observable sequences like this (letters and digits are "events"):</p> <pre><code>mm ----A---------B-------C------D-----------E-----&gt; | | | | | | | | | | mm.Skip(1) ----+---------1-------2------3-----------4-----&gt; | | | | | | | | | | mm.Zip(mm.Skip(1), ...) ----+--------A,1-----B,2----C,3---------D,4----&gt; </code></pre> <p>And it indeed has to do internal buffering. In the code that I posted, <code>mm</code> is the real, "live" observable. <code>mm.Skip(1)</code> is something like a state machine derived from it. Alex Paven's answer briefly explains how this works.</p> <p>So, <code>mm.Zip(mm.Skip(1), ...)</code> does indeed look at <code>mm</code> twice, once directly, and once through the <code>Skip(n)</code> filter. And because observables aren't repeatable sequences, it does internal buffering to account for the fact that one sequence will yield items sooner than the other.</p> <p>(I quickly glanced at the Rx source with .NET Reflector and indeed, <code>Zip</code> involves a <code>Queue</code>.)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload