<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Yep, that's really good.</div><div><br>On 25 Jan 2017, at 08:00, Jonathan Hull via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8">+1 &nbsp;Best so far.<div class=""><br class=""></div><div class=""><div class=""><div><blockquote type="cite" class=""><div class="">On Jan 24, 2017, at 10:36 AM, Pyry Jahkola via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><div class=""><span class=""></span></div><div class=""><div class=""><br class=""></div><div class="">Freak Show wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div class="">Am I the only one who finds this incredibly ugly and hard to read?</div><div class=""><br class=""></div><div class="">This is more or less solved by inject:into: idiom. &nbsp;There is no reason for inout for this particular problem.</div></div></blockquote><br class=""><div class="">Yeah, the original signature seems more useful. If you go all `inout` like Gwendal suggested, you might as well just iterate over the sequence with `for x in xs`, updating the state as you go.</div><div class=""><br class=""></div><div class="">But your comment brought another idea to mind: if `mutating:` is considered a bad name for a non-`inout` argument, how about `<b class="">reduce(into:combine:)`</b>, similar to what Karl suggested earlier in this thread?</div><div class=""><br class=""></div><div class="">I think it reads very well at the call site, does not suggest `inout`ness of the argument too much (of course there's no `&amp;` at the call site either), and it's still easily found with auto-completion:</div><div class=""><br class=""></div><div class="">&nbsp; &nbsp; let counts = words.reduce(into: [:]) {</div></div><div class="">&nbsp; &nbsp; &nbsp; $0[$1] = ($0[$1] ?? 0) + 1</div><div class="">&nbsp; &nbsp; }</div><div class=""><br class=""></div><div class="">— Pyry</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=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div></div></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></body></html>