<div dir="ltr"><div>I tested that behavior a bit more.</div><div>When lazy is called on non-collection that is converted to Array, it is iterated once. `underestimatedCount` is not used.</div><div>When lazy is called on collection that is converted to Array, `count` computed property is retrieved. Lazy collection types define `count` as iterating and filtering through the underlying collection.</div><div><br></div><div>I think there are two issues:</div><div>1. underestimatedCount should require O(1) complexity. Array initializer should always call it, as it perfectly suits its purpose</div><div>2. For collections, there should be choice to either use underestimateCount (safe default) or count</div><div><br></div><div>The &quot;right&quot; interface should look like:</div><div><br></div><div>init&lt;S: SequenceType&gt;(_ s: S)</div><div>init&lt;S: CollectionType&gt;(_ c: C, preciseCount: Bool = false)</div><div><br></div><div>If getting precise count requires computations (otherwise it would be in underestimatedCount), but programmer is sure that computations are cheap in the specific case, he can opt in explicitly.</div><div><br></div><div>- Anton</div><div><br></div><div>Sun Jun 19 13:03:03 CDT 2016, Haravikk &lt;<a href="mailto:swift-evolution@haravikk.me">swift-evolution@haravikk.me</a>&gt; wrote:</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">I think I agree that it’s a bug; as stated in the proposal the current behaviour allows .underestimatedCount to consume the entire sequence because sequences are potentially destructive (so its only possible to guarantee access to each element once). Actually, the fact that this hasn’t been discovered sooner suggests the current tests don’t include the use of destructive sequences, which may need to be considered too, as all Sequence methods should work correctly with both destructive and non-destructive sequences.<br>So yeah, I think having lazy sequences of this type return 0 for underestimateCount is the right solution for the time being.</blockquote></div>