<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><span></span></div><div><div><br></div><div>Freak Show wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8"><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><div>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><br></div><div>But your comment brought another idea to mind: if `mutating:` is considered a bad name for a non-`inout` argument, how about `<b>reduce(into:combine:)`</b>, similar to what Karl suggested earlier in this thread?</div><div><br></div><div>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><br></div><div>&nbsp; &nbsp; let counts = words.reduce(into: [:]) {</div></div><div>&nbsp; &nbsp; &nbsp; $0[$1] = ($0[$1] ?? 0) + 1</div><div>&nbsp; &nbsp; }</div><div><br></div><div>— Pyry</div></body></html>