> On Oct 26, 2016, at 22:23 , Dave Abrahams via swift-users > <swift-users@swift.org> wrote: > > > on Wed Oct 26 2016, Rick Mann <swift-users-AT-swift.org> wrote: > >> It seems fairly natural to want to do this: >> >> let bigDictionary = ... >> let smallerDictionary = bigDictionary.filter { key, value in <some test >> returning Bool> } > >> Similarly, it seems natural to want to map this way. > > It's reasonable for filter, but maybe not for map. Map follows certain > laws, and one of them is that you get the same number of elements out as > you put in. But you can easily map all keys to the same key, and the > law would be violated.
Sure map would produce a dictionary of the same number of entries. I didn't mean to imply map would also filter. But I'm basically transforming a JSON dictionary into a new version of that dictionary with fewer elements. I'd like to first filter it, then map it, and have the result be a dictionary. -- Rick Mann rm...@latencyzero.com _______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users