<div dir="ltr">`reduceInout`</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 17, 2017 at 6:30 PM, Xiaodi Wu via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Agree. The functional style should keep the functional name.<div class="HOEnZb"><div class="h5"><br><div class="gmail_quote"><div dir="ltr">On Tue, Jan 17, 2017 at 16:18 David Sweeris via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto" class="m_-5691644840527589899gmail_msg"><div class="m_-5691644840527589899gmail_msg"><br class="m_-5691644840527589899gmail_msg"></div><div class="m_-5691644840527589899gmail_msg">On Jan 17, 2017, at 16:11, Karl Wagner via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="m_-5691644840527589899gmail_msg" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br class="m_-5691644840527589899gmail_msg"><br class="m_-5691644840527589899gmail_msg"></div><blockquote type="cite" class="m_-5691644840527589899gmail_msg"><div class="m_-5691644840527589899gmail_msg"><br class="m_-5691644840527589899gmail_msg"><div class="m_-5691644840527589899gmail_msg"><blockquote type="cite" class="m_-5691644840527589899gmail_msg"><div class="m_-5691644840527589899gmail_msg">On 17 Jan 2017, at 23:09, Karl Wagner &lt;<a href="mailto:karl.swift@springsup.com" class="m_-5691644840527589899gmail_msg" target="_blank">karl.swift@springsup.com</a>&gt; wrote:</div><br class="m_-5691644840527589899m_2391106367995978672Apple-interchange-newline m_-5691644840527589899gmail_msg"><div class="m_-5691644840527589899gmail_msg"><div style="word-wrap:break-word" class="m_-5691644840527589899gmail_msg"><br class="m_-5691644840527589899gmail_msg"><div class="m_-5691644840527589899gmail_msg"><blockquote type="cite" class="m_-5691644840527589899gmail_msg"><div class="m_-5691644840527589899gmail_msg">On 16 Jan 2017, at 14:49, Chris Eidhof via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="m_-5691644840527589899gmail_msg" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br class="m_-5691644840527589899m_2391106367995978672Apple-interchange-newline m_-5691644840527589899gmail_msg"><div class="m_-5691644840527589899gmail_msg"><div dir="ltr" class="m_-5691644840527589899gmail_msg">Hi,<div class="m_-5691644840527589899gmail_msg"><br class="m_-5691644840527589899gmail_msg"></div><div class="m_-5691644840527589899gmail_msg">How does everyone feel about adding a second version of `reduce` to `Sequence`? Instead of a `combine` function that&#39;s of type `(A, Element) -&gt; A`, it would be `(inout A, Element) -&gt; ()`. This way, we can write nice functionals algorithms, but have the benefits of inout (mutation within the function, and hopefully some copy eliminations).</div><div class="m_-5691644840527589899gmail_msg"><br class="m_-5691644840527589899gmail_msg"></div><div class="m_-5691644840527589899gmail_msg">IIRC, Loïc Lecrenier first asked this on Twitter. I&#39;ve been using it ever since, because it can really improve readability (the possible performance gain is nice, too).</div><div class="m_-5691644840527589899gmail_msg"><br class="m_-5691644840527589899gmail_msg"></div><div class="m_-5691644840527589899gmail_msg">Here&#39;s `reduce` with an `inout` parameter, including a sample: <a href="https://gist.github.com/chriseidhof/fd3e9aa621569752d1b04230f92969d7" class="m_-5691644840527589899gmail_msg" target="_blank">https://gist.github.com/<wbr>chriseidhof/<wbr>fd3e9aa621569752d1b04230f92969<wbr>d7</a><br class="m_-5691644840527589899gmail_msg"></div><div class="m_-5691644840527589899gmail_msg"><div class="m_-5691644840527589899gmail_msg"><br class="m_-5691644840527589899gmail_msg"></div>-- <br class="m_-5691644840527589899gmail_msg"><div class="m_-5691644840527589899m_2391106367995978672gmail_signature m_-5691644840527589899gmail_msg">Chris Eidhof</div>
</div></div>
______________________________<wbr>_________________<br class="m_-5691644840527589899gmail_msg">swift-evolution mailing list<br class="m_-5691644840527589899gmail_msg"><a href="mailto:swift-evolution@swift.org" class="m_-5691644840527589899gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="m_-5691644840527589899gmail_msg"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="m_-5691644840527589899gmail_msg" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br class="m_-5691644840527589899gmail_msg"></div></blockquote></div><br class="m_-5691644840527589899gmail_msg"><div class="m_-5691644840527589899gmail_msg">+1</div><div class="m_-5691644840527589899gmail_msg"><br class="m_-5691644840527589899gmail_msg"></div><div class="m_-5691644840527589899gmail_msg">I would even argue for it to be the default.</div></div></div></blockquote></div><br class="m_-5691644840527589899gmail_msg"><div class="m_-5691644840527589899gmail_msg">I mean, assuming having two “reduce”s would stress the typechecker, as Joe suggested it might, I would say “inout” makes sense to be the default and the other one can find itself a new name. </div></div></blockquote><br class="m_-5691644840527589899gmail_msg"></div><div dir="auto" class="m_-5691644840527589899gmail_msg"><div class="m_-5691644840527589899gmail_msg">IIRC, the &quot;reduce&quot; name comes from functional programming... should the functional style keep the functional name?</div><div class="m_-5691644840527589899gmail_msg"><br class="m_-5691644840527589899gmail_msg"></div><div class="m_-5691644840527589899gmail_msg">- Dave Sweeris </div></div>______________________________<wbr>_________________<br class="m_-5691644840527589899gmail_msg">
swift-evolution mailing list<br class="m_-5691644840527589899gmail_msg">
<a href="mailto:swift-evolution@swift.org" class="m_-5691644840527589899gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="m_-5691644840527589899gmail_msg">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="m_-5691644840527589899gmail_msg" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br class="m_-5691644840527589899gmail_msg">
</blockquote></div>
</div></div><br>______________________________<wbr>_________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br>
<br></blockquote></div><br></div>