Persistent Bags / Multisets

Here's an implementation of a persistent bag/multiset, using a pmap to count elements.

This is pretty similar to collections.Counter in the Python stdlib, but less leaky :)

If you think it's not appropriate for pyrsistent, that's fine, I can release it as a separate library.

Since the PBag class is private (as are PMap, PVector etc) I decided to prefix it with an underscore.

And I just discovered that the existing empty singletons aren't really unique (I guess that's why you called it "singletonish"?) since you can easily get copies:

    >>> m().set('foo', 'bar').remove('foo') is m()
    False

This seems like it makes it a really bad idea to allow identity comparison.