[swift-evolution] [Proposal] mapValues

Brent Royal-Gordon brent at architechies.com
Wed Apr 13 02:48:51 CDT 2016


> I would really like to see something like the following added to the standard library:
> 
> extension Dictionary {
>     
>     func mapValues<U>(transform:(Key,Value)->U)->[Key:U] {
>         var output:[Key:U] = [:]
>         for (k,v) in self {
>             output[k] = transform(k,v)
>         }
>         return output
>     }
>     
> }

+1 from me, and +78 from people on Stack Overflow: <http://stackoverflow.com/a/24219069/41222>

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list