The Surprising Awesomeness of Grouped Dictionaries
Dictionary grouping provides a solid solution for sequence partitioning by predicates. But you can also do a lot more with this API. Let me give you a bunch of examples that showcase the power of this one little call.
Update (2017-06-20): Erica Sadun:
Dictionary
now has a feature that allows you to recognize you’re overwriting an existing key and apply a function to a key’s value each time the key is added. It’s calleduniquing
, and it lets you do neat things like count the number of times a token appears in a sequence[…]