jmitchell / multiset

Multiset/bag implementation in Rust
Apache License 2.0
9 stars 9 forks source link

Added op-equals and comparison operators #4

Closed BartMassey closed 4 years ago

BartMassey commented 7 years ago

For my current project I needed to be able to do <= and wanted to be able to do += and -= and the other comparison operators. These commits provide that functionality.

If you could accept this pull request and then update Cargo I would be grateful. Thanks!

BartMassey commented 7 years ago

Fixed the paper-bag eq() bug, moved the comparison operations to is_submultiset() and is_proper_submultiset(), and kept partial_cmp() as a named function that could be used to quickly implement the inequality operators if desired. Hopefully this is good enough now. I can refactor the commits if you insist, but I think these are reasonably clean?

The app I've written with it, by the way, is http://github.com/BartMassey/sugarmantra. Don't know if I mentioned that before.

Thanks for your time on this!

mashedcode commented 4 years ago

I don't mind the PartialEq and Sub implementation. Maybe even Add instead of union is not a bad idea since this is a multiset. But the Assign Implementations seem weird to me. Either ways this PR seems stale and needs to be rebased so I'd rather close this for now until someone actively works on this PR again.

jmitchell commented 4 years ago

I'm closing this since, as @mashedcode points out, it has gone stale. If there's still interest in adding features along these lines, let's discuss them more in the issues.