On Wed, Apr 10, 2002 at 11:32:04AM +0100, Mark Fowler wrote: > On Wed, 10 Apr 2002, Curt Sampson wrote: > > > > b) Doing proper set comparison (not bags) > > > > This I'm not sure about. You demonstrated some set comparison along > > these lines a while back, did you not? > > eq_set() is really bag comparison. I want a test which returns true iff > for every item in two lists there exists an item in the other list that > is identical. > > > but that you want to be using some sort of Set object and you're trying > > to use an array instead. > > Probably ;-) I was thinking of making both lists hashkeys and then > checking that !(%a + %b), or keys %a == keys %b and that grep { $a{$_} } > keys %b and grep { $b{$_} } keys %a.
Just to rain on your parade, don't forget about sets containing references. PS While we're on the subject of bad names and deep comparisons. I've been told by some folks that actually have CS degrees that is_deeply() is actually a "shallow" comparison. A deep comparison would check that the references themselves are equal. A shallow comparison checks that the values referenced are equal. Go figure. Either way, you usually want to be shallow for testing. -- Michael G. Schwern <[EMAIL PROTECTED]> http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One If you'll mount me, I'll let you bomb Canada until they swoon.