[swift-users] 2 x lazy collection bugs

Howard Lovatt howard.lovatt at gmail.com
Tue Feb 9 00:45:37 CST 2016

But it does say it is in-order. It says for SequenceType:

"A type that can be iterated with a for...in loop"

which means it must be in-order (for loops are allowed side effects). Also
why would you call something SequenceType if it wasn't sequential? It also
categorically says that you can't iterate multiple times reliably:

 "As a consequence, it is not possible to run multiple for loops on a
sequence to "resume" iteration".

So why am I seeing two passes?

And an index out of bounds?

  -- Howard.

On 9 February 2016 at 17:26, Jens Alfke <jens at mooseyard.com> wrote:

> On Feb 8, 2016, at 9:28 PM, Howard Lovatt via swift-users <
> swift-users at swift.org> wrote:
> Not sure where it says that it won't be sequential - do you have a
> reference?
> Not sure where it says it can be called more than one - the filter might
> be a very expensive operation like a database lookup!
> I think it’s more that the documentation *doesn’t* specify sequential
> ordering, and that it *doesn’t* say the closure is only called once … so
> you can’t assume that those conditions are true. You’re just inferring that
> they are, based on your intuition about the implementation.
> —Jens
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160209/89cc77c9/attachment.html>

More information about the swift-users mailing list