<div dir="ltr">I don't think we should replace the current `reduce` with the `inout` version, also because the current reduce can be really useful as well (e.g. when the return type is an Int). <div><br></div><div>One downside of having a different name is that it'll be harder to discover this version. If stressing the type-checker is the only problem, then maybe we should improve the type-checker, instead of placing that burden on every user of the language.</div><div><div><br></div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 18, 2017 at 9:36 AM, Karl Wagner via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><blockquote type="cite"><div><div class="h5"><div>On 18 Jan 2017, at 09:00, Anton Zhilin via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:</div><br class="m_-2796232354106425939Apple-interchange-newline"></div></div><div><div><div class="h5"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">While realizing that this name can cause confusion, I'd still prefer `reduce(mutating:_:)`, because it looks like the only readable option to me.</div><div class="gmail_quote">Whatever name will be picked, I agree that traditional reduce without mutation should retain its name.</div><div class="gmail_quote"><br></div><div class="gmail_quote">2017-01-18 5:17 GMT+03:00 Xiaodi Wu via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">A serious possibility would be: `reduce(mutableCopyOf: x) { ... }`.<div><br></div><div>It's verbose, but the nicer-looking `reduce(mutating: x) { ... }` is incorrect since, as Charles pointed out to Dave, it's not `x` that's mutated but rather a mutable copy of it, so it doesn't matter if `x` itself is declared with `let` or `var`. </div></div></blockquote></div></div></div></div></div>
______________________________<wbr>_________________<span class=""><br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br></span></div></blockquote></div><br><div>I suppose as a second-choice I’d go for accumulate(into: with:):</div><div><br></div><div>[1, 2, 3].accumulate(into: 0, with: +=) </div><div><br></div><div>even [1, 2, 3].accumulate(into: 0, with: -=) doesn’t look so bad IMO.</div><div><br></div><div>- Karl</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><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Chris Eidhof</div>
</div>