<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="">Although I see now that it <i class="">doesn’t</i> for arrays. ¯\_(ツ)_/¯<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 9 Dec 2015, at 01:21, Donnacha Oisín Kidney <<a href="mailto:oisin.kidney@gmail.com" class="">oisin.kidney@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Be careful with lazy.filter.first! It evaluates the whole sequence, usually.<br class=""><br class=""><a href="http://swiftstub.com/122568159/" class="">http://swiftstub.com/122568159/</a><br class=""><br class=""><blockquote type="cite" class="">On 9 Dec 2015, at 01:13, Brent Royal-Gordon via swift-evolution <swift-evolution@swift.org> wrote:<br class=""><br class=""><blockquote type="cite" class="">What about searching for something in an array? The not found code would go in the nobreak clause.<br class=""></blockquote><br class="">For an array, I would almost always use `if let` with `lazy.filter.first` or `indexOf`. The if branch is “found”, else is “not found”.<br class=""><br class="">If that wasn’t suitable for some reason, I’d probably put the search loop like that in its own function or method and return early from inside the loop. If you reach the code after the loop, the search has failed.<br class=""><br class="">I’m not saying it’s a useless feature, just that *I* can’t imagine using it.<br class=""><br class="">-- <br class="">Brent Royal-Gordon<br class="">Architechies<br class=""><br class="">_______________________________________________<br class="">swift-evolution mailing list<br class="">swift-evolution@swift.org<br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></blockquote><br class=""></div></div></blockquote></div><br class=""></div></body></html>