<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=""><div class="">Side question: is there going to be any situation where I’m iterating through a sequence/collection that I wouldn’t want to always use `lazy`? Is `lazy` *always* going to be more efficient than the array-creating defaults when the result is iterated?</div><div class=""><br class=""></div><div class="">For instance, something much better than this terrible syntax:</div><div class=""><br class=""></div><div class="">for a in sequence where .filter({ $0 > 5 }).map({ $0 * 2 }) {</div><div class=""> print(a)</div><div class="">}</div><div class=""><br class=""></div><div class="">It would be up to the compiler what calls it turns that into, possibly it could make a certain whitelist of transformations (filter, map) as efficient as using `for … where` or `guard` today? Or it could simply make use of `lazy`.</div><div class=""><br class=""></div><div class="">`for` is already hiding ‘magic’ by calling `makeIterator()`, why can’t it do more ‘magic’, especially since `lazy` is a member of `Sequence` just like `makeIterator()`.</div><div class=""><br class=""></div><div class="">Anyway, something for the future after Swift 3.0.</div><div class=""><br class=""></div><div class="">Patrick</div><br class=""><div><blockquote type="cite" class=""><div class="">On 28 Jun 2016, at 1:58 AM, Erica Sadun via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-family: Helvetica; font-size: 12px; 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="">Yeah, kicking myself over that. Can't Swift remind me to add `lazy` </div><div style="font-family: Helvetica; font-size: 12px; 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="">by emitting a warning or something? I keep assuming certain things are</div><div style="font-family: Helvetica; font-size: 12px; 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="">naturally lazy and then have to go back and de-eagerize.</div></div></blockquote></div><br class=""></body></html>