title: Cannot use try / with blocks inside sequence expressions. How to get around it?
body: <p>Consider that</p>
  
  <pre><code>Pentagonal numbers are generated by the formula, Pn=n(3n−1)/2.
  </code></pre>
  
  <p>I opted to create a sequence of pentagonal numbers in F#:</p>
  
  <pre><code>let pentagonalSeq = { 1..Int32.MaxValue } |&gt; Seq.map (fun n -&gt; n*(3*n-1)/2)
  </code></pre>
  
  <p>So far so good. For most purposes I'll only want to calculate a couple of small integer pentagonal numbers. But there may be times I wish, for instance, to get all <code>Int32</code> pentagonal numbers. I was thinking it would be possible to just go on calculating them until I eventually got an <code>OverflowException</code> (I'm using checked arithmetic). The trouble is that F# isn't particularly happy about my idea, yelling that </p>
  
  <pre><code>'try/with' cannot be used inside sequence expressions
  </code></pre>
  
  <p>What's the best way to keep this young lady satisfied?</p>
  
  <p>Assume that I want to create a <code>int32_pentagonalSeq</code> that:</p>
  
  <ol>
  <li>makes use of <code>pentagonalSeq</code></li>
  <li>does not incur in any extra calculations trying to predict whether the next item might or not might not originate an overflow.</li>
  </ol>
  
  <p>Thanks</p>