<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="">On May 1, 2016, at 5:13 AM, Brent Royal-Gordon via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><div><blockquote type="cite" class=""><br class="Apple-interchange-newline"><div class=""><div class=""><blockquote type="cite" class="">The proposal has been updated as per feedback from the core team (<a href="https://github.com/apple/swift-evolution/pull/275" class="">https://github.com/apple/swift-evolution/pull/275</a>). This includes removing some last vestiges of Swift 2 naming as well as replacing `iterate(_:apply:)` with an overloaded function `unfold(_:applying:)`.<br class=""></blockquote><br class="">The proposal says this:<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>public func unfold&lt;T, State&gt;(_ initialState: State, applying: State -&gt; (T, State)?) -&gt; UnfoldSequence&lt;T&gt;<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>public func unfold&lt;T&gt;(_ initialElement: T, apply: T -&gt; T) -&gt; UnfoldSequence&lt;T&gt;<br class=""><br class="">However, the comment implies that the second one should instead be this:<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>public func unfold&lt;T&gt;(_ initialElement: T, applying: T -&gt; T?) -&gt; UnfoldSequence&lt;T&gt;<br class=""><br class="">I'm not sure I like having these be overloaded on only the return type of the closure. Maybe we could do something like this?<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>public func unfold&lt;T, State&gt;(fromState initialState: State, applying: State -&gt; (T, State)?) -&gt; UnfoldSequence&lt;T&gt;<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>public func unfold&lt;T&gt;(fromFirst initialElement: T, apply: T -&gt; T) -&gt; UnfoldSequence&lt;T&gt;<br class=""><br class="">That way you're calling either `unfold(fromState:applying:)` or `unfold(fromFirst:applying:)`. (Some further bikeshedding might be needed hereā€”it's late and I'm tired.)<br class=""></div></div></blockquote></div><br class=""><div class="">I really don't want to see this discussion die as I have a vested interest in getting this functionality into</div><div class="">Swift 3. So let me suggest that</div><div class=""><br class=""></div><div class=""><font face="Menlo" class="">`sequence(_:, next:) -&gt; AdHocSequence`</font></div><div class=""><br class=""></div><div class="">might be a Swift acceptable solution. &nbsp;We're not going to see fold/unfold pair happen. It's a given that</div><div class="">`reduce` is a fixed point in Swift space and `sequence` well describes what this should be doing.</div><div class=""><br class=""></div><div class="">So is it possible to push forward with `sequence`, whose only negative seems to be that it's not as well</div><div class="">loved as `unfold`?</div><div class=""><br class=""></div><div class="">-- Erica</div><div class=""><br class=""></div></body></html>