[swift-users] 2 x lazy collection bugs

Jens Alfke jens at mooseyard.com
Tue Feb 9 11:23:23 CST 2016

> On Feb 8, 2016, at 11:54 PM, Dmitri Gribenko via swift-users <swift-users at swift.org> wrote:
> Oh, right, now I see the issue.  The issue again caused by the
> non-purity of the closure passed to filter(). 

It makes sense that the closures passed to functional operations like filter() and map() should be pure, but I don’t see that documented. It would probably be a good idea to call this out explicitly, for the benefit of those not used to functional programming.

(I think someone earlier in this thread said that “all closures should be pure”, but of course that’s not true in Swift in general. This exposes the tension between functional and non-functional uses of Swift.)

[I’m by no means an expert at functional programming, but I develop a database engine that uses map/reduce for indexing, and I’m very used to having to remind users that their map functions need to be pure :) ]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160209/303debf8/attachment.html>

More information about the swift-users mailing list