Re: [swift-users] Why can I not filter or map a dictionary to another dictionary?

2016-10-26 Thread Vincent O'Sullivan via swift-users
Ah. Having seen the other answers, I can now see the implied question. On 27/10/2016, 07:39, "Vincent O'Sullivan via swift-users" wrote: You can. You just need to get the syntax right: let smallerDictionary = bigDictionary.filter { (key, value) in } let bd = [1:"A", 2:"

Re: [swift-users] Why can I not filter or map a dictionary to another dictionary?

2016-10-26 Thread Vincent O'Sullivan via swift-users
You can. You just need to get the syntax right: let smallerDictionary = bigDictionary.filter { (key, value) in } let bd = [1:"A", 2:"B", 3:"C"] let sd = bd.filter{(k, v) in k > 1} dump(sd) On 27/10/2016, 01:12, "Rick Mann via swift-users" wrote: It seems fairly natural to want to do

Re: [swift-users] Why can I not filter or map a dictionary to another dictionary?

2016-10-26 Thread Dave Abrahams via swift-users
on Wed Oct 26 2016, Rick Mann wrote: > It seems fairly natural to want to do this: > > let bigDictionary = ... > let smallerDictionary = bigDictionary.filter { key, value in returning Bool> } > Similarly, it seems natural to want to map this way. It's reasonable for filter, but maybe not for

Re: [swift-users] Why can I not filter or map a dictionary to another dictionary?

2016-10-26 Thread Hooman Mehr via swift-users
The rational for returning Array is here: https://github.com/apple/swift/blob/master/docs/StdlibRationales.rst#high-order-functions-on-collections-return-arrays I have this s

[swift-users] Why can I not filter or map a dictionary to another dictionary?

2016-10-26 Thread Rick Mann via swift-users
It seems fairly natural to want to do this: let bigDictionary = ... let smallerDictionary = bigDictionary.filter { key, value in } Similarly, it seems natural to want to map this way. Am I overlooking something? -- Rick Mann rm...@latencyzero.com