<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">I'm +1 for adding mapValues. Very useful functionality and trivial to implement.&nbsp;</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div class="bloop_container"><div class="bloop_frame"> &gt; &gt; I.e. I suggest to implement and mapKeys() also. It could be also useful in some situations.<br>&gt; `mapKeys` is much more dangerous, because you could end up mapping many values into a single key. You kind of need to combine the values somehow. Perhaps:<br>&gt; <br>&gt; extension Dictionary {<br>&gt; func mapValues<outvalue>(_ valueTransform: @noescape Value throws -&gt;OutValue) rethrows -&gt;[Key: OutValue] { … }<br>&gt; <br>&gt; func mapKeys<outkey: hashable="">(_ keyTransform: @noescape Key throws -&gt;OutKey) rethrows -&gt;[OutKey: [Value]] { … }<br>&gt; <br>&gt; // Possibly flatMap variants, too?<br>&gt; }<br>&gt; <br>&gt; extension Dictionary where Value: Sequence {<br>&gt; func reduceValues<outvalue>(_ initial: OutValue, combine: @noescape (OutValue, Value.Iterator.Element) throws -&gt;OutValue) rethrows -&gt;[Key: OutValue] {<br>&gt; return mapValues { $0.reduce(initial, combine: combine) }<br>&gt; }<br>&gt; }<br>&gt; <br>&gt; Which you would end up using like this:<br>&gt; <br>&gt; let wordFrequencies: [String: Int] = …<br>&gt; let firstLetterFrequencies: [Character: Int] = wordFrequencies.mapKeys { $0.characters.first! }.reduceValues(0, combine: +)<br>&gt; <br>&gt; --<br>&gt; Brent Royal-Gordon<br>&gt; Architechies<br>&gt; <br>&gt; <br>&gt; <br>&gt;  </outvalue></outkey:></outvalue></div></div><br><div class="bloop_sign" id="bloop_sign_1460543250984733952"><div style="font-family:helvetica,arial;font-size:13px">--&nbsp;<br>Miguel Angel Quinones<br></div></div></body></html>