> On 24 May 2016, at 11:50, Brent Royal-Gordon <[email protected]> wrote:
> 
>> For this the key/value pair constructor for Dictionary would be the better 
>> option, since the .map() method essentially already lets you do this. Adding 
>> key transformation to .mapValues() would only make it less specialised (it’s 
>> called .mapValues after all ;), plus it would be incompatible with any 
>> simultaneous/future lazy implementation since you can’t just transform the 
>> keys lazily (you also need a way to transform them back if you intend to use 
>> them for lookups).
> 
> He was suggesting the transform be of type (Key, Value) -> NewValue; that is, 
> it would be able to see what the key was, but it wouldn't be able to 
> transform the key.

Whoops right you are, sorry! Hmm, in that case, any examples that need the key 
for the transformation? I usually view keys as arbitrary, so needing them for 
this seems a little strange (hence my misunderstanding, at least that’s the 
reason I’m going to stand by in favour of “I can’t read” ;)
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to