title: Seq.zip in F# may require seemingly extra sequence element to complete
body: <p>Let's Seq.zip two F# sequences, one represented by a list and the other - by Seq.filter applied to an infinite sequence:</p>
  
  <pre><code>Seq.initInfinite (fun i -&gt; i)
  |&gt; Seq.filter ((&gt;) 3)
  |&gt; Seq.zip ["A";"B"]
  </code></pre>
  
  <p>returns as expected </p>
  
  <pre><code>val it : seq&lt;string * int&gt; = seq [("A", 0); ("B", 1)]
  </code></pre>
  
  <p>However,</p>
  
  <pre><code>Seq.initInfinite (fun i -&gt; i)
  |&gt; Seq.filter ((&gt;) 2)
  |&gt; Seq.zip ["A";"B"]
  </code></pre>
  
  <p>hangs on trying to get non-existing 3rd member that can pass Seq.filter and eventually blows up fsi:</p>
  
  <pre><code> Error: Enumeration based on System.Int32 exceeded System.Int32.MaxValue.
  </code></pre>
  
  <p>although the other argument represented by list of letters hints that just two filtered elements would be enough to perform zip to the function specification.</p>
  
  <p>If we turn to Haskell for implementation comparison the equivalent</p>
  
  <pre><code> zip ["A","B"] (filter (&lt;2) [0..])
  </code></pre>
  
  <p>completes without any problem yielding</p>
  
  <pre><code>[("A",0),("B",1)]
  </code></pre>
  
  <p>As Haskell implementation behavior seem intuitively right what is the justification for the observed behavior of F# Seq.zip implementation?</p>
  
  <p>UPDATE:</p>
  
  <p>I did not notice that Haskell</p>
  
  <pre><code>zip (filter (&lt;2) [0..]) ["A","B"]
  </code></pre>
  
  <p>does not complete similarly to F#.</p>
  
  <p><strong>Bottom line:</strong> It is impossible to implement Zip function capable of zipping sequences of defined and undefined lengths in argument order-agnostic manner. F# Zip implementation simply prefers invariant to argument order behavior over Haskell argument order dependent one. </p>