<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On 18 Jan 2017, at 09:00, Anton Zhilin 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 dir="ltr" class=""><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 class=""></div><div class="gmail_quote">2017-01-18 5:17 GMT+03:00 Xiaodi Wu via swift-evolution <span dir="ltr" class=""><<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>></span>:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="">A serious possibility would be: `reduce(mutableCopyOf: x) { ... }`.<div class=""><br class=""></div><div class="">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>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""><div class="">I suppose as a second-choice I’d go for accumulate(into: with:):</div><div class=""><br class=""></div><div class="">[1, 2, 3].accumulate(into: 0, with: +=) </div><div class=""><br class=""></div><div class="">even [1, 2, 3].accumulate(into: 0, with: -=) doesn’t look so bad IMO.</div><div class=""><br class=""></div><div class="">- Karl</div></body></html>