I’ve had a matcher in my head for a couple months, that I frequently
want but never get around to writing because I can’t think of the name
for it. Here’s how it would look
[1, 2, 3, 4, 1].should … [1, 3, 1, 4, 2]
I have a couple ideas for names, but I’ll hold off on them so I don’t
influence anyone’s opinion.
btw, I realize that .sort works in this case. But that’s slightly
less clear than I’d like, and it doesn’t work for non-Comparable
objects (like activerecords).
I’ve had a matcher in my head for a couple months, that I frequently
want but never get around to writing because I can’t think of the name
for it. Here’s how it would look
I’ve had a matcher in my head for a couple months, that I frequently
want but never get around to writing because I can’t think of the name
for it. Here’s how it would look
[1, 2, 3, 4, 1].should … [1, 3, 1, 4, 2]
An unordered collection with possibly multiple occurrences of its
members is known in mathematics as a “multiset,” or, informally, a
“bag.”
An unordered collection with possibly multiple occurrences of its
members is known in mathematics as a “multiset,” or, informally, a
“bag.”
I (standing knee-deep in mathematics) was about to offer the following
be_multiset_equal_to
be_set_equal_to
Set equality is slightly (imo not fatally) incorrect, and multiset
might be alien to majority of hackers out there. I’d prefer either of
these or modifications.
i wrote this matcher myself for a project i’m working on and have been
calling it `equals_without_regard_to_order’. it’s an unwieldy name
and i’ve never really been comfortable with it but i’ve continued to
use it, mostly because i’m dim.
very curious to find a winning replacement on this list!