<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 8, 2016, at 11:54 PM, Dmitri Gribenko via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Alegreya-Regular; font-size: 15px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Oh, right, now I see the issue. The issue again caused by the</span><br style="font-family: Alegreya-Regular; font-size: 15px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Alegreya-Regular; font-size: 15px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">non-purity of the closure passed to filter(). </span></div></blockquote><br class=""></div><div>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.</div><div><br class=""></div><div>(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.)</div><div><br class=""></div><div>[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 :) ]</div><div><br class=""></div><div>—Jens</div></body></html>